Skip to main content
Glama

Search Code

search_code

Find relevant code in an indexed codebase using semantic AST search, so you can answer symbol and cross-stack queries without grepping or reading whole files.

Instructions

Semantic AST code search. Always call this before reading files or running grep.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "search_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYes
top_kNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.4/5.0
Behavior3/5

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

No annotations exist, so the description carries the full behavioral burden. It does disclose the search modality (semantic AST rather than keyword), which is genuinely useful, but says nothing about index freshness, scope of the codebase indexed, or result shape beyond what the output schema covers.

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?

Two short sentences, front-loaded with the defining capability before the usage directive. No wasted words, though the unqualified 'Always' is a strong imperative that may not hold in every scenario.

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?

Return values are covered by the existing output schema, so their absence from the description is acceptable. However, with an undocumented two-parameter schema and no behavioral detail on index scope or staleness, the definition is only minimally complete for a search tool whose query semantics matter a great deal.

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

Parameters2/5

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

Schema description coverage is 0%, so both 'query' and 'top_k' are undocumented in structured form. The description never mentions either parameter, so it does nothing to compensate for the coverage gap — an agent must guess whether query is natural language, a code snippet, or an AST pattern, and what top_k controls.

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?

Names a specific operation and resource ('Semantic AST code search'), and the 'semantic AST' qualifier signals it is meaning/structure-based rather than literal text matching, which implicitly separates it from grep-style tools. It doesn't explicitly differentiate from the sibling get_code_chunk, so it stops short of a 5.

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?

Gives a clear directive on when to reach for it: 'Always call this before reading files or running grep' establishes an ordering preference against concrete alternative approaches. There is no when-not guidance and the sibling get_code_chunk is never mentioned as an alternative.

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

Deploy Server

Other Tools