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 <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel
2026-10-19 07:45:37 +02:00
parent c2ee12200c
commit 5e345e32c0
2 changed files with 18 additions and 6 deletions
+14 -6
View File
@@ -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) {
+4
View File
@@ -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);