Skip to main content
Glama
bluemot
by bluemot

CRAG-MCP: Config-Aware Code Graph via MCP

程式碼 graph 建構與查詢 MCP Server,支援條件編譯(#ifdef)動態過濾。 每個 workspace 獨立儲存 graph + config,支援多專案比較。

核心概念:Config-Aware Graph

傳統 Graph:
  cfg80211_p2p_init() ──→ cfg80211_get_bss()
  (不知道這個 function 需要什麼條件才能存在)

CRAG Graph:
  cfg80211_p2p_init()
    active_conditions: {"WIFI_P2P_SUPPORT": "y"}
    ──→ cfg80211_get_bss()
  
  Query: preprocess_config({"WIFI_P2P_SUPPORT": "n"})
  Result: cfg80211_p2p_init() 被自動過濾掉
  
  Query: preprocess_config({"WIFI_P2P_SUPPORT": "y"})
  Result: cfg80211_p2p_init() 出現

Related MCP server: CodeAnalysis MCP Server

架構

crag-mcp/
├── crag_mcp/
│   ├── core/
│   │   ├── workspace.py          # Workspace 掃描
│   │   └── config_context.py     # Config / #ifdef 管理
│   ├── parsers/
│   │   └── tree_sitter_parser.py # AST + #ifdef 條件提取
│   ├── llm/
│   │   └── small_llm.py           # Semantic analysis
│   ├── graph/
│   │   └── kuzu_graph.py         # Kùzu + active_conditions
│   └── server/
│       └── mcp_server.py         # 7 tools
├── pyproject.toml
└── README.md

MCP Tools (7)

Tool

用途

configure(workspace_path?, small_llm?)

設定 workspace 與 LLM

preprocess_config(config_path?, define_overrides?, workspace_path?)

載入條件編譯設定(綁定 workspace)

query_graph(query, max_results?, workspace_path?)

搜尋(自動套用 config 過濾)

get_callers(func, depth?, workspace_path?)

Graph: upstream(config-aware)

get_callees(func, depth?, workspace_path?)

Graph: downstream(config-aware)

get_call_path(A, B, workspace_path?)

Graph: path(config-aware)

graph_stats(workspace_path?)

Graph 狀態

所有查詢 tool 都接受 workspace_path 參數,指向要操作的 workspace。 不傳則用最後一次 configure() 設定的 workspace。

Atomic 設計哲學

每個 workspace 完全獨立,各自擁有自己的:

/ws/A/.crag-mcp/
├── graph.kuzu/           # Kùzu DB(函式 + 呼叫關係)
└── file_cache/           # parse cache
  • query_graph(ws=A) 只查 A 的 DB、只套 A 的 config

  • query_graph(ws=B) 只查 B 的 DB、只套 B 的 config

  • 兩者完全不會互相干擾

Agent(或 LLM)負責 orchestration — 輪流查不同 workspace,再自行比較結果。

使用流程

1. 一般專案(無 #ifdef)

configure(workspace_path="/path/to/project")
query_graph("authentication flow")
# 無條件過濾,所有 code 都出現

2. C / Linux Kernel(有 #ifdef)

configure(workspace_path="/path/to/linux")
preprocess_config(
    config_path="/path/to/linux/.config",
    define_overrides={"WIFI_P2P_SUPPORT": "y"}
)
query_graph("WIFI P2P implementation")
# 只有 WIFI_P2P_SUPPORT=y 的 code 會出現

# 改 config,重新查詢
preprocess_config(
    config_path="/path/to/linux/.config",
    define_overrides={"WIFI_P2P_SUPPORT": "n"}
)
query_graph("WIFI P2P implementation")
# P2P 相關 code 被自動過濾掉

3. 多 Workspace 比較(Agent 層次)

configure(workspace_path="/ws/A")
preprocess_config(config_path="/ws/A/.config", workspace_path="/ws/A")

configure(workspace_path="/ws/B")
preprocess_config(config_path="/ws/B/.config", workspace_path="/ws/B")

result_a = query_graph("wifi p2p flow", workspace_path="/ws/A")
result_b = query_graph("wifi p2p flow", workspace_path="/ws/B")

# Agent 自行比較,再決定要不要查 C
result_c = query_graph("wifi p2p flow", workspace_path="/ws/C")

preprocess_config 支援的格式

格式

範例

說明

Linux .config

CONFIG_WIFI=y

自動 parse

C Header

#define WIFI 1

#define 提取

Makefile

CFLAGS += -DWIFI=1

-D 提取

JSON

{"WIFI": "y"}

直接載入

Manual

define_overrides={}

程式設定

Config 過濾邏輯

# Graph node 儲存
{
    "name": "cfg80211_p2p_init",
    "active_conditions": {"WIFI_P2P_SUPPORT": "y"}
}

# Query 時比對
preprocess_config(define_overrides={"WIFI_P2P_SUPPORT": "n"})
# → cfg80211_p2p_init 被過濾(條件不滿足)

preprocess_config(define_overrides={"WIFI_P2P_SUPPORT": "y"})
# → cfg80211_p2p_init 出現(條件滿足)

# 無 active_conditions → 永遠出現(always active)

本地儲存位置

每個 workspace 會在自己的根目錄下建立 .crag-mcp/ 目錄:

/path/to/project/.crag-mcp/
├── graph.kuzu/           # Kùzu DB(二進制目錄)
└── file_cache/           # parse cache(JSON)

加到 .gitignore

.crag-mcp/

安裝

cd /path/to/crag-mcp/
pip install -e .

或使用 uv

cd /path/to/crag-mcp/
uv pip install -e .

OpenCode 設定

{
  "mcpServers": {
    "crag": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/crag-mcp", "-m", "crag_mcp.server.mcp_server"],
      "env": {
        "CRAG_WORKSPACE": "${workspaceFolder}",
        "CRAG_SMALL_LLM": "gemma4:31b-cloud"
      }
    }
  }
}

Agent 決策流程

Agent 看到專案:
├── 有 .config / Kconfig / #ifdef → 呼叫 preprocess_config()
├── 純 Python / JS / Go → 不呼叫(無條件編譯)
└── 使用者提到 "kernel" / "config" → 詢問是否 preprocess

Token 節省

場景

傳統

CRAG-MCP

Kernel query

餵全部 code(含 dead code)

只查 active code

Config 切換

重新 index 整個 repo

只改 query 條件

#ifdef 分析

LLM 自己猜條件

graph 標記清楚

License

MIT

Available Tools

9 tools
configureC

Configure workspace and LLM.

ParametersJSON Schema
NameRequiredDescriptionDefault
llm_endpointNo
workspace_pathNo
small_llm_modelNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavioral traits. It only says 'Configure workspace and LLM' without indicating whether this modifies state, requires permissions, or has side effects. Insufficient for a configure operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise (3 words), but lacks substance. It is not bloated, but the brevity sacrifices clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema, the description provides no context about the tool's effect (e.g., persistent config vs temporary) or expected usage. Incomplete for a configuration tool with no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description adds no explanation of the three parameters (llm_endpoint, workspace_path, small_llm_model). An agent cannot infer parameter details from the description alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description states verb 'Configure' and resources 'workspace' and 'LLM', clearly identifying the tool's purpose. It distinguishes from siblings that have specific operations like preprocess_config or query_graph, but does not explicitly differentiate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like preprocess_config. No context on prerequisites or typical usage flow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_calleesB

Find functions called by the given function.

ParametersJSON Schema
NameRequiredDescriptionDefault
depthNoCall depth (default: 1)
function_nameYesFunction name to look up
workspace_pathNoTarget workspace (default: last configured)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry full burden. It only states the basic function and does not disclose behavioral traits such as read-only nature, required permissions, or any side effects. The description is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (5 words) and front-loaded with the core purpose. It avoids fluff but is perhaps too terse, lacking necessary context. Still, it is efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity and the presence of an output schema, the minimal description covers the basic purpose. However, it omits any contextual details about handling depth or workspace, making it adequate but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description does not add meaning beyond the schema for parameters like depth or workspace_path. It covers function_name implicitly but adds no extra details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Find functions called by the given function,' specifying the verb (find) and resource (functions called). It effectively distinguishes from sibling tools like get_callers (which finds callers) and get_call_path (path).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There is no mention of context, prerequisites, or when not to use it. With multiple sibling tools, the agent lacks direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_callersC

Find functions that call the given function.

ParametersJSON Schema
NameRequiredDescriptionDefault
depthNoCall depth (default: 1)
function_nameYesFunction name to look up
workspace_pathNoTarget workspace (default: last configured)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does not disclose behavioral traits such as whether the operation is read-only, how depth affects results, or any authorization requirements. The description adds no value beyond the basic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, which is concise. However, it may be too brief to be fully informative, but the conciseness itself is good.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists (not shown), so return values need not be explained. However, the description does not clarify the depth parameter's effect or workspace scope behavior. It is adequate but has gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, meaning all three parameters (depth, function_name, workspace_path) are described in the input schema itself. The description adds no additional meaning beyond the schema, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Find functions that call the given function' clearly states the tool's purpose with a specific verb and resource. However, it does not differentiate from sibling tools like 'get_callees' (which finds called functions) or 'get_call_path', so it lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives, prerequisites, or limitations. The description is too brief to help the agent decide between this and similar tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_call_pathA

Find call path between two functions using BFS.

Requires call edges in the graph (populated by summarize_function()).

ParametersJSON Schema
NameRequiredDescriptionDefault
max_depthNoMaximum search depth (default: 10, max: 100)
to_functionYesTarget function
from_functionYesStart function
workspace_pathNoTarget workspace (default: last configured)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden. It mentions BFS and the max_depth parameter, but does not disclose whether the operation is read-only, what happens if no path exists, or error handling. This is adequate but could be more transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with no fluff: first sentence states core purpose, second gives a crucial prerequisite. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (pathfinding with BFS, prerequisite state), the description covers the key context. It lacks details on what happens if no path is found or if workspace_path is needed, but the output schema likely covers return values. Slightly incomplete but mostly sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds no additional parameter-level detail beyond what the schema provides (e.g., max_depth default and max are already in schema). It does not enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool finds a call path between two functions using BFS, which is a specific verb-resource combination. It distinguishes itself from siblings like get_callers/get_callees by focusing on paths rather than direct calls.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states the prerequisite (call edges populated by summarize_function()), providing clear context for when to use. It does not explicitly mention when not to use or list alternative tools, but the purpose is distinct.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

graph_statsC

Get graph statistics for a workspace.

ParametersJSON Schema
NameRequiredDescriptionDefault
workspace_pathNoTarget workspace (default: last configured)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description carries the full burden. It only states 'get graph statistics' without disclosing whether it is a read-only operation, requires authentication, or any side effects. This is insufficient for a tool with no structured behavioral hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no wasted words. However, it is overly sparse and could include more context without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's name and the presence of an output schema, the description should clarify what 'graph statistics' include (e.g., nodes, edges, metrics). It lacks completeness for a tool with one parameter and no sibling differentiation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already describes the parameter with 100% coverage, including a description. The tool description adds no additional meaning beyond what the schema provides, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it gets graph statistics for a workspace, using a specific verb and resource. However, it does not differentiate from sibling tools like query_graph or get_callers, which could overlap in purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description implies usage when graph statistics are needed, but offers no exclusions or context about preferred scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

preprocess_configA

Load preprocessing config for conditional compilation.

Call this when analyzing C/C++ projects with #ifdef blocks, Linux kernel with Kconfig, or Makefile-based builds.

Supports:

  • Linux .config files

  • C header files with #define

  • Makefiles with CFLAGS -D

  • JSON files

  • Manual define overrides

ParametersJSON Schema
NameRequiredDescriptionDefault
config_pathNoPath to config file (.config, .h, Makefile, .json)
workspace_pathNoTarget workspace (default: last configured)
define_overridesNoExtra defines {name: value} (e.g., {"WIFI_P2P": "y"})

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full responsibility for behavioral disclosure. It does not mention side effects, return value (despite output schema existing), idempotency, or required permissions. It focuses only on what the tool does, not how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise: two sentences and a bullet list. It front-loads the primary purpose and then provides supporting details in an organized list. Every sentence adds value, with no redundant or filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers tool purpose, usage context, and parameter details well. However, it omits any mention of the return value or side effects. Since an output schema exists, the description could be more complete by referencing what the tool returns, but it is still effective for selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage, the baseline is 3. The description adds meaningful context beyond the schema by listing supported file formats (e.g., .config, .h, Makefile, JSON) and explaining when to use manual define overrides. This enriches parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool loads preprocessing config for conditional compilation, with specific verb 'load' and resource 'preprocessing config'. It distinguishes from siblings like 'configure' by targeting use cases for C/C++ #ifdef blocks, Linux Kconfig, and Makefile-based builds.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to call ('when analyzing C/C++ projects with #ifdef blocks, Linux kernel with Kconfig, or Makefile-based builds') and lists supported file types. However, it does not provide explicit exclusions or alternative tools, which would earn a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_graphA

Search code graph. Automatically indexes relevant files.

If preprocess_config() was called on the workspace, filters by active defines. Otherwise returns all functions (no filtering).

Parses source files into the graph with AST (no LLM). Use summarize_function() on individual results for deep analysis.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
max_resultsNoMax results to return (default: 10)
workspace_pathNoTarget workspace (default: last configured)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses automatic indexing, AST-based parsing (no LLM), filtering logic, and fallback behavior. With no annotations, this fully covers behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Very concise (4 sentences), front-loaded with purpose, and every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, schema coverage, and presence of output schema, the description covers key aspects: filtering, indexing, no-LLM, and referral to sibling for deep analysis.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so description adds no new param details. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states 'Search code graph' as verb+resource, and differentiates from sibling tools by explaining filtering behavior and suggesting summarize_function for deeper analysis.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides context on when filtering applies (if preprocess_config was called) and directs to summarize_function for deeper analysis, but does not explicitly state when to use other siblings like get_callers or get_callees.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_function_bodyB

Read the full source code of a function.

ParametersJSON Schema
NameRequiredDescriptionDefault
function_nameYesName of the function
workspace_pathNoTarget workspace (default: last configured)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The verb 'Read' implies a non-destructive operation, which is the primary behavioral trait. However, with no annotations, the description does not disclose other traits like caching, permissions, or error handling. The output schema mitigates some need for return format details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no extraneous words. It is front-loaded, but could include more context without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (two parameters, one required) and the presence of an output schema, the description is minimally adequate. However, it lacks usage guidelines and behavioral depth, which would improve completeness for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (both parameters have descriptions in the schema). The description adds no additional meaning about parameters beyond what is already structured, so it meets the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Read' and explicitly states the resource 'full source code of a function', making the action and target clear. It implies differentiation from siblings like 'summarize_function', but does not explicitly compare.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'summarize_function' or 'get_callers'. There is no mention of prerequisites, conditions, or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

summarize_functionA

Deep-analyze a single function with LLM (summary + call extraction).

Call this after query_graph() to enrich specific functions. Results (summary, keywords, call edges) are stored in the graph and become available to get_callers(), get_callees(), get_call_path().

ParametersJSON Schema
NameRequiredDescriptionDefault
function_nameYesName of the function to analyze
workspace_pathNoTarget workspace (default: last configured)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full responsibility. It discloses that results (summary, keywords, call edges) are stored in the graph, implying a write operation. It does not explicitly mention mutational behavior or required permissions, but the side effects are described sufficiently for an LLM agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences long, each serving a distinct purpose: defining the action, specifying when to use it, and detailing the outcomes. It is front-loaded with the most critical information and contains no unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description, combined with the fully documented schema and the presence of an output schema, provides sufficient completeness. It covers the tool's purpose, when to invoke it, and what happens to the data, making it well-suited for an AI agent to select and use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds context by referring to 'a single function,' which reinforces the function_name parameter's purpose. However, it does not elaborate on parameter details beyond the schema. This slight added value justifies a score of 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs a deep-LLM analysis of a single function, producing a summary and call extraction. It distinguishes itself from siblings by explicitly stating the invocation order (after query_graph) and noting that results feed into other tools like get_callers and get_callees.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises to call this tool after query_graph() to enrich specific functions, establishing a clear usage order and context. It also states that results become available to other tools, helping the agent understand the tool's role in the pipeline.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 9 tool updatesv0.1.0
    • First observedconfigure
    • First observedget_call_path
    • First observedget_callees
    • First observedget_callers
    • First observedgraph_stats
    • First observedpreprocess_config
    • First observedquery_graph
    • First observedread_function_body
    • First observedsummarize_function

TDQS

B3.2/5.0

Scored across 9 tools

Disambiguation4/5

The tools are mostly distinct in purpose. `configure` and `preprocess_config` both relate to setup but target different aspects (general workspace vs. preprocessing for conditional compilation). Other tools like `read_function_body`, `query_graph`, and the call graph tools have clearly separate roles. A minor overlap exists but descriptions help disambiguate.

Naming Consistency2/5

Tool names are inconsistent: some follow verb_noun (read_function_body, query_graph, summarize_function, get_callers), while `configure` is a bare verb, `preprocess_config` uses verb_noun but with a different verb style, and `graph_stats` is noun_noun with no verb. This mixed pattern reduces predictability.

Tool Count4/5

9 tools is appropriate for a code analysis server covering configuration, code reading, graph indexing, function summarization, and call queries (callers, callees, paths). The scope feels well-balanced without being too heavy or too thin.

Completeness4/5

The tool set covers the main workflows for call graph analysis: setup, source retrieval, graph search, deep analysis, and call relationship queries. Missing features like variable cross-references or type queries are beyond the stated domain, so the set is reasonably complete for its purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers