[connectors] Single tool registry — one definition → runtime + MCP + API
The enabling refactor. Today a tool is defined up to 3× (runtime AGENT_TOOLS/STORAGE_TOOLS def + switch/case executor in lib/tools.ts/lib/storage-tools.ts, and a hand-written MCP server.tool() in workers/mcp), with names drifting. Every new capability triples the work and rots.
Do
- One
ToolDef { name, description, schema (JSON Schema), handler(ctx, input), tier, connector? } as the source of truth (extend the existing shared ToolDef in lib/tools.ts).
- Runtime tool-calling (
agent-think.ts loop) derives definitions + dispatch from the registry (replace the switch/case with a registry lookup).
- MCP (
workers/mcp) auto-generates its tools from the registry (kill the hand-written list + naming drift).
- Keep the per-agent allowlist (
config.capabilities.tools) semantics unchanged.
Acceptance
Part of the connector/tool framework epic. Blocks the connector work.
[connectors] Single tool registry — one definition → runtime + MCP + API
The enabling refactor. Today a tool is defined up to 3× (runtime
AGENT_TOOLS/STORAGE_TOOLSdef + switch/case executor inlib/tools.ts/lib/storage-tools.ts, and a hand-written MCPserver.tool()inworkers/mcp), with names drifting. Every new capability triples the work and rots.Do
ToolDef { name, description, schema (JSON Schema), handler(ctx, input), tier, connector? }as the source of truth (extend the existing sharedToolDefinlib/tools.ts).agent-think.tsloop) derives definitions + dispatch from the registry (replace the switch/case with a registry lookup).workers/mcp) auto-generates its tools from the registry (kill the hand-written list + naming drift).config.capabilities.tools) semantics unchanged.Acceptance
Part of the connector/tool framework epic. Blocks the connector work.