Skip to content

docs(config): document MCP tool-key composition contract in ARCHITECTURE.md#846

Merged
ausard merged 1 commit into
masterfrom
auto/844-mcp-tool-key-composition-docs
Jun 24, 2026
Merged

docs(config): document MCP tool-key composition contract in ARCHITECTURE.md#846
ausard merged 1 commit into
masterfrom
auto/844-mcp-tool-key-composition-docs

Conversation

@ausard

@ausard ausard commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #844.

Adds a new ### MCP tool key composition subsection under ## MCP Integration in docs/ARCHITECTURE.md that documents the namespacing contract every consumer of getAllTools() must respect. The subsection covers:

  • Qualified key shape: ${escapedServer}::${tool} with the separator being exactly two ASCII colons.
  • Escape order: % first, then : — with a TS code block and the rationale (double-escape trap).
  • Reverse-escape order: %3A first, then %25 — the mirror image, also with rationale.
  • Split rule: callers MUST lastIndexOf('::'), not indexOf, because tool names themselves may contain ::.
  • Display vs. routing: UI MAY strip the prefix for rendering, but routing, permission rules, and hook matchers MUST use the full qualified key. Never round-trip the display form back into dispatch.
  • Forward cross-link to the canonical helpers in src/mcp/client.ts (escapeServerName, parseQualifiedName, getToolByQualifiedName) — landing in the companion [mcp] issue.

Also annotates the MCP row in the Support Systems module table (line 193) so readers scanning the table land on the new subsection.

Why

Per the research brief this is doc lock-in: code-only fixes regress without documentation (the streaming-error contract in #839 already burned us with the same pattern). Once MCP tools wire into the agent loop, additional callers will dispatch by name and need to know the escape / split / display rules.

Upstream reference: anomalyco/opencode#33596 (commit 6c12c32, 2026-06-24).

Scope

Docs-only. No files under src/ or tests/ are modified. The companion [mcp] issue lands the runtime helpers referenced in the cross-link.

Verification

  • npm run format:check — green (only checks src/ and tests/).
  • npm run lint — 0 errors (1275 pre-existing warnings unrelated to this change).
  • npm run typecheck — clean.
  • Visual inspection: new ### MCP tool key composition heading appears at line 819, between the existing MCP overview and ## Directory Structure (was line 816, now line 916).

[alexi-bot]

Add a new "MCP tool key composition" subsection under "## MCP Integration"
in docs/ARCHITECTURE.md that codifies the namespacing rule landed in the
companion mcp issue, so a second consumer of getAllTools() cannot silently
drift from the contract.

The subsection documents:

- Qualified key shape: ${escapedServer}::${tool}
- Escape order (% first, then :) with a code example
- Reverse-escape order (%3A first, then %25) with a code example
- Split-on-LAST-:: rule with a code example (tool names may contain ::)
- Display-vs-routing rule: UI may strip the prefix, but routing,
  permissions, and hook matchers must use the full qualified key
- Forward cross-link to src/mcp/client.ts helpers (escapeServerName,
  parseQualifiedName, getToolByQualifiedName)

Also annotate the MCP row in the Support Systems module table to point
at the new subsection, so readers scanning the table find the contract.

Docs-only change. No files under src/ or tests/ touched.

Refs #844 [alexi-bot]
@ausard ausard enabled auto-merge (squash) June 24, 2026 19:41
@github-actions

Copy link
Copy Markdown
Contributor

Documentation Update Skipped\n\nNo code changes detected since the last documentation generation. The documentation is already up to date.\n\n---\nGenerated by Kilo CLI

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Metric Coverage
Lines 61.73%
Statements 61.74%
Functions 57.22%
Branches 56.16%
Coverage Details
  • Lines: 7478/12113
  • Statements: 7783/12605
  • Functions: 1168/2041
  • Branches: 4160/7407

@ausard ausard merged commit c93e5f9 into master Jun 24, 2026
13 checks passed
@ausard ausard deleted the auto/844-mcp-tool-key-composition-docs branch June 24, 2026 19:44
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.

[config] Document MCP tool-key composition contract in ARCHITECTURE.md

1 participant