LearnNewsExamplesServices
Frontmatter
id9846
titlefeat: Implement `create_component` Neural Link Tool
stateClosed
labels
enhancementai
assigneesneo-opus-vega
createdAtApr 10, 2026, 10:33 AM
updatedAtJun 15, 2026, 9:46 PM
githubUrlhttps://github.com/neomjs/neo/issues/9846
authortobiu
commentsCount4
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[x] 13157 create_component (Slice 2): multi-window targeting + get_component_tree visibility + E2E proof, [ ] 9848 feat: Implement Neural Link Transaction/Undo Stack for Agent-Driven UI Mutations, [x] 9847 feat: Implement `remove_component` Neural Link Tool
closedAtJun 14, 2026, 2:45 AM

feat: Implement create_component Neural Link Tool

tobiu
tobiu commented on Apr 10, 2026, 10:33 AM

Summary

Add a dedicated create_component tool to the Neural Link MCP server that provides a first-class, schema-validated interface for agents to dynamically create components within live Neo.mjs applications at runtime.

A2A Context (Fat Ticket Protocol)

Agent: Claude Opus 4.6 (Antigravity) Session Origin: Multi-Window Agent Shell architecture session

Problem

Currently, runtime component creation via Neural Link requires agents to use the generic call_method tool (e.g., calling container.add() on a target container). This works but lacks:

  • Schema validation — no enforcement that the component config is valid before dispatching
  • Window targeting — in multi-window SharedWorker apps, the agent must manually resolve which window's container to target
  • Error handlingcall_method returns raw errors with no semantic context about what went wrong
  • Discoverability — agents must know the internal API (container.add()) rather than expressing intent

Proposed Solution

Add a dedicated create_component tool to the Neural Link MCP server that:

  1. Accepts a component config (ntype/module, properties) and a target container ID
  2. Validates the config against known class blueprints (via inspect_class)
  3. Handles multi-window routing via the existing SharedWorker bridge
  4. Returns the created component's ID and serialized state
  5. Supports optional windowId parameter for explicit window targeting

Tool Schema (Draft)

{
  "name": "create_component",
  "parameters": {
    "containerId": "string (required) — ID of the target container",
    "config": "object (required) — Neo.mjs component config (ntype, text, items, etc.)",
    "index": "number (optional) — insertion index within the container's items",
    "windowId": "string (optional) — target window in multi-window apps",
    "sessionId": "string (optional) — App Worker session ID"
  }
}

Architectural Context

  • Bridge.mjs (ai/mcp/server/neural-link/Bridge.mjs) — WebSocket hub between App Workers and agents
  • InstanceService (src/ai/client/InstanceService.mjs) — callMethod() at line ~85-130 is the current workaround
  • Related: #9535 (conversational UIs concept), #9671 (agent evolution roadmap)
  • Dependency: None — additive to the existing NL tool surface

Pitfalls Identified

  • Component creation must go through the App Worker, not the Main Thread — the bridge must route correctly
  • The created component needs to be registered in Neo.manager.Component for subsequent NL queries to find it
  • If useSharedWorkers: true, the creation must be dispatchable to a specific window's DOM
  • Must handle both ntype-based (lazy) and module-based (explicit import) component resolution

Acceptance Criteria

  • create_component tool registered in NL MCP server
  • Schema validation rejects invalid configs with actionable error messages
  • Created components appear in get_component_tree results
  • Multi-window targeting works when useSharedWorkers: true
  • E2E test validates component creation and subsequent inspection
tobiu added the enhancement label on Apr 10, 2026, 10:33 AM
tobiu added the ai label on Apr 10, 2026, 10:33 AM
tobiu added the feature label on Apr 10, 2026, 10:33 AM
tobiu removed the feature label on May 28, 2026, 12:16 AM
tobiu closed this issue on Jun 14, 2026, 2:45 AM
tobiu referenced in commit 044aad5 - "feat(neural-link): add the create_component write-locked NL tool (#9846) (#13154) on Jun 14, 2026, 2:45 AM