Skip to main content
Glama

codegraph_query

Query a codebase knowledge graph using natural language to find dependencies, callers, or specific node details. Combines graph traversal and node lookup for efficient code analysis.

Instructions

Ask a structural question about the codebase OR look up a specific node by name — or both in one call. Pass question for natural-language traversal: what calls X, what does module Y depend on. Pass node for fast single-node lookup: returns type, file, depends_on, used_by. Pass both to get node detail + surrounding graph context together. Returns structured text within token_budget. Use before reading any files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesProject root
questionNoNatural language question about the codebase
nodeNoNode name or partial name to look up (type, file, deps, callers)
token_budgetNoMax tokens in response (default 2000)
Behavior4/5

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

No annotations are provided, so the description bears full responsibility. It explains the tool's behavior for question-only, node-only, and combined usage. It mentions the return format ('structured text within token_budget'). This adequately discloses core 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?

The description is concise—four sentences that convey purpose, usage modes, and a critical usage tip ('Use before reading any files'). No redundancy; each sentence earns its place.

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 no output schema, the description adequately covers the return format ('structured text within token_budget'). It explains the three operational modes and the token_budget parameter. While more detail on the output structure could be added, it is sufficient for the tool's complexity.

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%, but the description adds significant meaning beyond the schema: explaining how 'question' and 'node' can be used independently or together, and the role of 'token_budget'. This adds practical semantic value for an agent.

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 answers structural questions about the codebase and performs node lookups. It uses specific verbs ('ask', 'look up', 'traversal') and distinguishes itself from sibling tools like codegraph_build by focusing on queries.

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 provides clear usage guidance: use for natural-language questions or node lookups, and 'use before reading any files'. It implies when to use (structural queries) and suggests combining both parameters. However, it does not explicitly state when not to use or name alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vibhasdutta/context-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server