|
| 1 | +"""What this tree registers: the standalone tools and the gated ones. |
| 2 | +
|
| 3 | +The number appears in a test, in nine documents, in the docker-smoke floor |
| 4 | +and in the host-contract verifier, and every one of them used to carry its |
| 5 | +own copy. One copy went stale: `scripts/verify_mcp_hosts.py` held 52 while |
| 6 | +the surface moved to 54 (ADR-1066), which nothing noticed until the count |
| 7 | +reached 57 and broke its ceiling (issue #597). |
| 8 | +
|
| 9 | +This module is the one place that counts, read from the registries rather |
| 10 | +than stated. It imports the registry modules only, never the server, so a |
| 11 | +caller pays no MCP startup for a count. |
| 12 | +
|
| 13 | +source: ADR-1077""" |
| 14 | + |
| 15 | +from __future__ import annotations |
| 16 | + |
| 17 | +from mcp_server import ( |
| 18 | + tool_registry_advanced, |
| 19 | + tool_registry_core, |
| 20 | + tool_registry_ingest, |
| 21 | + tool_registry_manage, |
| 22 | + tool_registry_memory, |
| 23 | + tool_registry_memory_maintenance, |
| 24 | + tool_registry_nav, |
| 25 | + tool_registry_predictions, |
| 26 | + tool_registry_wiki, |
| 27 | + tool_registry_wiki_drafts, |
| 28 | +) |
| 29 | + |
| 30 | +# The three tools that register only when their upstream MCP server is |
| 31 | +# configured; every advertised tool works without one (ADR-0093). |
| 32 | +UPSTREAM_TOOL_NAMES: frozenset[str] = frozenset( |
| 33 | + {"ingest_codebase", "change_impact", "ingest_prd"} |
| 34 | +) |
| 35 | + |
| 36 | +_STANDALONE_REGISTRIES = ( |
| 37 | + tool_registry_core, |
| 38 | + tool_registry_memory, |
| 39 | + tool_registry_memory_maintenance, |
| 40 | + tool_registry_manage, |
| 41 | + tool_registry_nav, |
| 42 | + tool_registry_predictions, |
| 43 | + tool_registry_advanced, |
| 44 | + tool_registry_wiki, |
| 45 | + tool_registry_wiki_drafts, |
| 46 | +) |
| 47 | + |
| 48 | + |
| 49 | +def standalone_tool_names() -> frozenset[str]: |
| 50 | + """Every tool name that registers without an upstream MCP server.""" |
| 51 | + names: set[str] = set() |
| 52 | + for registry in _STANDALONE_REGISTRIES: |
| 53 | + names.update(registry.SCHEMAS) |
| 54 | + names.update(set(tool_registry_ingest.SCHEMAS) - UPSTREAM_TOOL_NAMES) |
| 55 | + return frozenset(names) |
0 commit comments