Skip to main content
Glama
dalebrubaker

sourcegraph-mcp

by dalebrubaker

find_symbol_definition

Locates the file path and line number where a symbol (function, class, variable) is defined, using SourceGraph's indexed symbol search.

Instructions

Find where a symbol (function, class, method, variable, constant) is DEFINED in the codebase. Returns the exact file path and line number where the symbol is declared.

This uses SourceGraph's indexed symbol search for fast lookups. Perfect for 'go to definition' or 'where is X defined?' queries.

Returns: File path, line number, and column position of the definition.

Examples:

  • Find where the ProcessOrder function is defined

  • Locate the definition of class CustomerService

  • Find where variable API_KEY is declared

  • Show me where the HandleRequest method is defined

Tips:

  • Use symbol_kind filter to narrow results (function, class, method, variable)

  • Use repo_filter to search specific repositories (e.g., 'repo:myorg/myrepo')

  • Searches are case-sensitive by default

Note: To find where a symbol is USED (not defined), use find_symbol_references instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbol_nameYesName of the symbol to find (e.g., 'ProcessOrder', 'CustomerService', 'API_KEY')
symbol_kindNoOptional: Filter by symbol kind to narrow results
repo_filterNoOptional: Filter by repository (e.g., 'repo:owner/name' or 'repo:^github\.com/org/project$')
max_resultsNoMaximum number of results (default: 10)
Behavior4/5

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

No annotations provided, but the description discloses the use of SourceGraph's indexed search, return format (file path, line, column), and tips. Could be more explicit about being a read-only operation, but overall adequate.

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?

Well-structured with clear sections: description, returns, examples, tips, note. Concise and front-loaded with key information.

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 4 parameters, no output schema, and the complexity of symbol definition lookup, the description covers purpose, parameters, usage, return values, and sibling differentiation comprehensively.

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?

All parameters have schema descriptions, and the tool description adds value with examples, tips (case-sensitivity, filters), and usage context that extends 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?

The description clearly states the tool finds where a symbol (function, class, etc.) is DEFINED, using specific verbs and resource. It distinguishes from sibling find_symbol_references.

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?

Explicitly states when to use ('go to definition' queries) and when not to use (for symbol usage, use find_symbol_references). Provides clear 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/dalebrubaker/sourcegraph-mcp'

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