Skip to main content
Glama

find_definition

Read-onlyIdempotent

Jump to a symbol's definition when you know its name, returning the first match with its body and other matches with signatures. Indicates whether AST/graph precision or BM25 was used.

Instructions

Jump to where a symbol is defined, when you already know its name; the first match comes with its body, the others with their signature. AST-precise with the graph layer, BM25 otherwise; each hit says which. Use search when you can only describe the code, describe_symbol for the callers and tests too.

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": {
      "symbol": "<symbol>"
    },
    "name": "find_definition"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMax results.
sourceNoSource name. Omit when only one source applies.
symbolYesIdentifier, e.g. `MyClass` or `MyClass.handleClick`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.12.0
    • removedInput schema / properties / source / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / source / default
      Removed value: -null
    • addedInput schema / properties / source / type
      Added value: +"string"
  2. Addedv1.9.0

TDQS

A4.3/5.0
Behavior4/5

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

Beyond the read-only/idempotent annotations, it discloses non-obvious behavior: the first hit returns a full body while later hits return only signatures, and results come from either an AST-precise graph pass or a BM25 fallback with each hit labeled accordingly. Not covered: what happens when nothing matches or how ambiguous symbols are ranked.

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?

Three tight clauses, front-loaded with the primary action before the fallback caveat and the alternative routing. Only nit is the inconsistent backticking of `search` vs. describe_symbol and the slightly compressed 'the others with their signature' phrasing.

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?

No output schema exists, so the description must convey return shape, and it does (body vs. signature, per-hit provenance). Remaining gap is empty-result and ambiguity behavior, which matters for a lookup tool that can legitimately return nothing.

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 `symbol`, `limit`, and `source` are already documented in structured data. The description reinforces that `symbol` is a known identifier but adds no format, ranking, or truncation detail beyond the schema.

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?

States a specific verb and resource ('Jump to where a symbol is defined') plus the precondition ('when you already know its name'), which separates it from description-based lookup tools without requiring the sibling schemas to be opened.

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?

Gives an explicit when-to-use condition (you already know the name) and names two alternatives with the conditions that select them: `search` when you can only describe the code, describe_symbol when you need callers and tests. Both when and when-not are covered.

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