|
| 1 | +# Feature: Tool visibility whitelist in manifest |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +`create_server()` registers every auto-generated tool for every entity — CRUD (6), graph traversal (3), and activity tools per entity type. For an app with 6 entities, that's 67+ tools before any custom tools are added. |
| 6 | + |
| 7 | +This overwhelms LLM clients: |
| 8 | +- Claude Desktop took 16 seconds to process the `tools/list` response (278K chars of tool schemas) |
| 9 | +- LLMs struggle with tool selection when presented with 77 options |
| 10 | +- Most auto-generated tools are irrelevant for the use case (e.g., `create_session` and `delete_speaker` on a read-only conference app) |
| 11 | + |
| 12 | +## Current workaround |
| 13 | + |
| 14 | +Monkey-patching `_list_tools` after `create_server()`: |
| 15 | + |
| 16 | +```python |
| 17 | +mcp = create_server(str(MANIFEST), root=str(WORKSPACE)) |
| 18 | + |
| 19 | +_VISIBLE_TOOLS = {"find_sessions", "create_bookmark", "get_speaker", ...} |
| 20 | + |
| 21 | +_original_list_tools = mcp._list_tools |
| 22 | + |
| 23 | +async def _filtered_list_tools(): |
| 24 | + all_tools = await _original_list_tools() |
| 25 | + return [t for t in all_tools if t.name in _VISIBLE_TOOLS] |
| 26 | + |
| 27 | +mcp._list_tools = _filtered_list_tools |
| 28 | +``` |
| 29 | + |
| 30 | +This works — hidden tools remain registered and callable via `tools/call`, they just don't appear in `tools/list`. But it's fragile and requires knowing FastMCP internals. |
| 31 | + |
| 32 | +## Proposed solution |
| 33 | + |
| 34 | +### Option A: Manifest-level visibility per entity |
| 35 | + |
| 36 | +```json |
| 37 | +{ |
| 38 | + "entities": [ |
| 39 | + { |
| 40 | + "name": "session", |
| 41 | + "prefix": "ss", |
| 42 | + "schema": "schemas/session.schema.json", |
| 43 | + "tools": { |
| 44 | + "visible": ["get", "search"] |
| 45 | + } |
| 46 | + }, |
| 47 | + { |
| 48 | + "name": "bookmark", |
| 49 | + "prefix": "bk", |
| 50 | + "schema": "schemas/bookmark.schema.json", |
| 51 | + "tools": { |
| 52 | + "visible": ["create", "list", "delete"] |
| 53 | + } |
| 54 | + } |
| 55 | + ] |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +`tools.visible` is a whitelist of which auto-generated tool categories to include in `tools/list`. Options: `create`, `get`, `update`, `list`, `search`, `delete`, `query_by_relationship`, `get_related`, `get_composite`. |
| 60 | + |
| 61 | +Default (no `tools` key): all tools visible (current behavior). |
| 62 | + |
| 63 | +### Option B: `create_server()` parameter |
| 64 | + |
| 65 | +```python |
| 66 | +mcp = create_server( |
| 67 | + manifest_path, |
| 68 | + root="./workspace", |
| 69 | + visible_tools=["create_bookmark", "list_bookmarks", "get_session", ...] |
| 70 | +) |
| 71 | +``` |
| 72 | + |
| 73 | +### Option C: Global visibility config in manifest |
| 74 | + |
| 75 | +```json |
| 76 | +{ |
| 77 | + "_meta": { |
| 78 | + "ai.nimblebrain/upjack": { |
| 79 | + "tool_visibility": { |
| 80 | + "mode": "whitelist", |
| 81 | + "include": ["create_bookmark", "list_bookmarks", "delete_bookmark", ...] |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +## Recommendation |
| 89 | + |
| 90 | +Option A is the best — it's declarative, per-entity, and lives in the manifest where the entity definitions already are. The app author decides at schema time which operations are relevant for each entity type. |
| 91 | + |
| 92 | +For reference data entities (session, speaker, sponsor), you'd set `"visible": ["get"]` or `"visible": ["get", "search"]`. For personal data entities (bookmark, note, connection), you'd set `"visible": ["create", "list", "delete"]` or similar. |
| 93 | + |
| 94 | +## Impact |
| 95 | + |
| 96 | +The MCP Dev Summit app went from 77 tools to 21 visible tools with the workaround. The `tools/list` response dropped from 278K chars to ~50K, and tool selection accuracy improved significantly. |
| 97 | + |
| 98 | +## Notes |
| 99 | + |
| 100 | +- Hidden tools must remain callable — `tools/call` with a hidden tool name should still work |
| 101 | +- This is a listing/discoverability concern, not a security concern |
| 102 | +- Graph traversal and activity tools should also be controllable (default: hidden unless opted in) |
| 103 | +- The `seed_data`, `add_field`, and `rebuild_index` utility tools should have their own visibility toggle |
0 commit comments