Skip to main content
Glama

find_code

Search indexed code symbols by name, keyword, or docstring to get ranked signatures and locations without loading file content, including third-party libraries.

Instructions

Searches indexed symbols (functions, classes, methods, constants, types) by name, keyword, or docstring. Returns ranked results with signatures and locations, no file content loaded. Also searches indexed third-party libraries. ~50 tokens per result vs ~2000 for reading each file.

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": "find_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNoFilter by symbol kind
repoNoFilter to a specific repository (as shown in list_repos)
queryYesSearch query (name, keyword, or description)
languageNoFilter by programming language (e.g., python, typescript, go)
max_resultsNoMaximum results to return
file_patternNoGlob pattern to filter by file path (e.g., 'src/**/*.py')
token_budgetNoOptional token budget -- greedy-pack results until budget is exhausted. Reports tokens_used and tokens_remaining in _meta.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.10.2

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the ranking behavior, the shape of results (signatures and locations), that file content is not loaded, cross-library coverage, and a cost heuristic. It omits prerequisites such as whether the repo must already be indexed and what happens on a cold/unindexed target.

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?

Three tightly packed sentences, front-loaded with what is searched and returned, then closed with the cost rationale that justifies use. No filler or redundancy with the field names.

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?

For a 7-parameter search tool with no output schema and no annotations, the description covers purpose, result shape, scope, and cost. The remaining gaps are operational edge cases (indexing prerequisite, empty-result or error behavior, _meta reporting beyond the token_budget field) rather than core usage information.

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 description coverage is 100%, so the schema already documents kind, repo, language, max_results, file_pattern, and token_budget in detail. The description only adds meaning for query (name, keyword, or docstring) and implicitly token cost; it adds nothing for the filtering parameters. Baseline 3 applies.

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 names a specific verb and resource ("searches indexed symbols") and enumerates the symbol types covered, plus the query modes (name, keyword, docstring) and scope extension to third-party libraries. It doesn't explicitly distinguish itself from siblings like find_text or find_similar_code, so an agent must infer the boundary.

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 "~50 tokens per result vs ~2000 for reading each file" framing gives clear context for choosing this over file-reading, and "no file content loaded" reinforces that. It stops short of naming alternative tools or stating when-not-to-use it (e.g., for raw text search or unindexed code).

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