From 5e345e32c01d2cd3473aef2cd2e1b83469721ecf Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Mon, 19 Oct 2026 07:45:37 +0200 Subject: [PATCH] feat(mcp): state the structural questions in the scout and analysis profiles The read-only analysis profile and the fast scout profile serve the graph subagents (codebase-memory-auditor, codebase-memory-scout). Their server instructions listed tools only. Like the default profile, they now state as facts which structural questions the graph answers (where a symbol is defined, who calls a function, what it calls, and for analysis also call chains, data flow and change impact), keywords first: analysis 190 -> 648 characters, scout 199 -> 427, well within Claude Code's 4,096-character cut. The profile names, check_index_coverage and the absence of index_repository are unchanged. Stacked on #2698. Refs #509 Signed-off-by: Martin Vogel --- src/mcp/mcp.c | 20 ++++++++++++++------ tests/test_mcp.c | 4 ++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/mcp/mcp.c b/src/mcp/mcp.c index 3d1a864c0..f6e43b317 100644 --- a/src/mcp/mcp.c +++ b/src/mcp/mcp.c @@ -1473,14 +1473,22 @@ static const char MCP_SERVER_INSTRUCTIONS[] = "Results are paginated."; static const char MCP_ANALYSIS_SERVER_INSTRUCTIONS[] = - "analysis tool profile: read-only graph work via search_graph, trace_path, " - "get_code_snippet, query_graph, get_architecture, or search_code. Use check_index_coverage " - "for cited paths; paginate."; + "analysis tool profile (read-only): a code knowledge graph of the indexed repository for " + "structural questions: where a symbol is defined, who calls a function, what it calls, call " + "chains and data flow, which code a change affects, how modules fit together. search_graph " + "finds symbols; trace_path follows callers, callees and data flow; get_code_snippet returns " + "exact source; query_graph runs multi-hop Cypher; get_architecture summarizes structure; " + "search_code combines text search with graph context; detect_changes maps the current diff " + "to affected symbols. check_index_coverage tells whether a cited file was fully indexed. " + "Results are paginated."; static const char MCP_SCOUT_SERVER_INSTRUCTIONS[] = - "scout tool profile: fast positive discovery via search_graph, trace_path, " - "get_code_snippet, or get_architecture with narrow limits. Use check_index_coverage for " - "cited paths. Findings are provisional."; + "scout tool profile (fast, provisional): quick structural lookups in the indexed " + "repository: where a symbol is defined, who calls a function, what it calls. search_graph " + "finds symbols; trace_path follows callers and callees; get_code_snippet returns exact " + "source; get_architecture summarizes structure; narrow limits keep answers fast. " + "check_index_coverage tells whether a cited file was fully indexed. Findings are " + "provisional."; static char *cbm_mcp_initialize_response_for_profile(const char *params_json, cbm_mcp_tool_profile_t profile) { diff --git a/tests/test_mcp.c b/tests/test_mcp.c index ade684372..1ced07c95 100644 --- a/tests/test_mcp.c +++ b/tests/test_mcp.c @@ -2195,6 +2195,9 @@ TEST(server_handle_analysis_profile_filters_and_rejects_mutators) { ASSERT_NOT_NULL(strstr(resp, "analysis tool profile")); ASSERT_NOT_NULL(strstr(resp, "check_index_coverage")); ASSERT_NULL(strstr(resp, "index_repository")); + /* Profile instructions name the structural questions, like the default. */ + ASSERT_NOT_NULL(strstr(resp, "who calls a function")); + ASSERT_NOT_NULL(strstr(resp, "which code a change affects")); free(resp); resp = cbm_mcp_server_handle(srv, "{\"jsonrpc\":\"2.0\",\"id\":220,\"method\":\"tools/list\"}"); @@ -2237,6 +2240,7 @@ TEST(server_handle_scout_profile_exposes_only_the_fast_tier) { ASSERT_NOT_NULL(strstr(resp, "scout tool profile")); ASSERT_NOT_NULL(strstr(resp, "check_index_coverage")); ASSERT_NULL(strstr(resp, "index_repository")); + ASSERT_NOT_NULL(strstr(resp, "who calls a function")); ASSERT_FALSE(mcp_saw_autoindex_log); free(resp);