Skip to content

feat(extension): serve tools as {id}_{name}, read both forms - #214

Draft
vreshch wants to merge 2 commits into
masterfrom
feature/tool-names-single-underscore
Draft

vreshch wants to merge 2 commits into
masterfrom
feature/tool-names-single-underscore

Conversation

@vreshch

@vreshch vreshch commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Problem

The kit names each MCP tool {id}__{name}, with two underscores. The name must become {id}_{name}. Every rule that reads a tool name knows only the old form, so one extension on the new kit would show as down on a host with an older reader.

Change

  • Writer: prefixed() in packages/extension/src/mcp/tools.ts gives {id}_{name}. The served list, the record, the discovery document and the generated {id}.mcpc.json follow it.
  • Readers accept both forms:
    • PrefixedToolNameSchema (manifest/primitives.schema.ts), used by the record and discovery schemas.
    • The three generated JSON schemas: extension-discovery, extension-record, host-document.
    • toolsAreOwn (discovery/discovery.schema.ts), through the new ownsTool(id, name). It guards the discovery document, the record and each entry of the host document.
    • The app host program: it checks each extension document with the kit schema (combineHost and hostDocumentOf), so it has no rule of its own. It ships as @agentage/apphost 0.5.0 on kit ~0.23.0.
    • The widget bridge (packages/widget/src/host/bridge.ts): the same rule, copied, because the widget does not depend on the kit.
  • Not a reader of both forms: tools/call matches only the name that the kit serves. A part on this kit answers {id}_{name} and refuses a call of {id}__{name}. No alias exists.
  • Tests, docs, the READMEs of extension and widget, and the names in template/.
  • Versions: @agentage/extension 0.23.0, @agentage/apphost 0.5.0, @agentage/widget 0.5.0. CI refuses a version-only PR, so the bumps are here. This PR makes no tag and no release.
  • CI: the Template verify and check job ran agentage extension check from the cli, which bundles the released kit. On a kit change it now runs the check of the candidate kit (scripts/check-candidate.mjs), as the up step already does.

The rule that keeps one underscore unambiguous

An id is [a-z][a-z0-9-]*: it holds no underscore. A tool's own name starts with a letter. So the id of a served name is the text before the first underscore, and only one split exists.

ownsTool(id, name) is true only when name starts with id and the rest is one or two underscores, then a letter. Thus a does not own a-b_x (the rest starts with -), and probe does not own probex_echo. The old form cannot collide with the new one: a__x read in the new form would be the tool _x, which the registry refuses.

packages/extension/src/manifest/tool-name.test.ts pins the rule: both forms, a longer id, a hyphen id, three underscores, an id with an underscore, a tool name that starts with an underscore.

How verified

  • npm run verify at the root is green.
  • New tests: both forms pass the schemas, combineHost runs one answer of each form, the app host document lists both forms and puts a foreign tool down, and the bridge calls both forms and refuses the others.
  • CI on this PR runs the probe from the examples branch of the same name (probe_echo).

Known red check

Probe local gate on this kit runs a gate suite that still expects probe__echo. It stays red until that suite accepts both forms. This PR stays in draft until then.

What the reviewer must check

  • Is each reader of a tool name covered? git grep -n "__" -- packages template has tool name hits only in the both-form rules and their tests. The other hits are cookie prefixes and test hooks.
  • The tools/call decision: no alias for the old name on a new kit.
  • After the merge, template/ has the new names but still pins the released kit and widget. Until those pins move, a new extension made from the template serves {id}__echo, so its extension check and its widget call fail. A PR that touches only template/ meets the same case in CI.

https://claude.ai/code/session_01XQkodgygL4W8UcLQDwC212

The kit names each tool {id}_{name}. The schemas, toolsAreOwn, the app
host program and the widget bridge accept {id}_ and the old {id}__.
Kit 0.23.0, apphost 0.5.0, widget 0.5.0.

Claude-Session: https://claude.ai/code/session_01XQkodgygL4W8UcLQDwC212
The cli bundles the released kit, so its check names tools in the old
form. On a kit change the template job now runs the candidate's check.
The widget README note moves below its code block.

Claude-Session: https://claude.ai/code/session_01XQkodgygL4W8UcLQDwC212
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant