Skip to main content
Glama

code_search

Search source code using natural language queries. Find functions, classes, or code snippets across your codebase with filters for language, path, and output format.

Instructions

Semantic code search. Auto-indexes on first use, incrementally updates thereafter.

Args: query: Natural language description of what you're looking for. Supports special syntax: - function:name or fn:name - search for specific function - class:name or cls:name - search for specific class - struct:name - search for specific struct (Rust, C, Go) - path:prefix - filter to paths starting with prefix - -path:pattern - exclude paths containing pattern path: Root path of codebase (defaults to current directory) mode: "file", "chunk" (function/class level), or "both" (combined) limit: Max results to return (default 10) language: Filter by language (python, typescript, etc.) path_prefix: Only return results from paths starting with prefix (e.g., "src/") exclude_paths: Exclude paths containing these strings (e.g., ["test", "vendor"]) output_format: Output format - "text", "json", or "markdown"

Returns: Formatted search results with file paths and relevant code

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoboth
pathNo.
limitNo
queryYes
languageNo
path_prefixNo
exclude_pathsNo
output_formatNotext

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Discloses auto-indexing behavior, parameter effect (e.g., special syntax), and return format. No annotations provided, so description carries full burden. Could mention performance implications on first use.

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?

Well-structured with Args and Returns sections. Front-loaded with purpose. Slightly verbose but every sentence adds value; could trim minor redundancies.

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?

Covers purpose, parameters, behavior, and return format adequately given the tool's complexity. Output schema exists but is not detailed in description; still sufficient for agent to use. Sibling context differentiates tool well.

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

Parameters5/5

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

Schema has 0% description coverage, but the Args section thoroughly explains all 8 parameters, including special syntax for query, defaults, and enum options. This compensates excellently for the lack of schema descriptions.

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?

Clearly states 'Semantic code search' with auto-indexing, distinguishing it from sibling tools like find_references (exact symbol lookup) and search_changed (recent changes). The verb 'search' and resource 'code' are specific.

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?

Provides clear context: 'Semantic code search' and 'Auto-indexes on first use' imply when to use. However, it does not explicitly state when not to use or contrast with siblings, leaving some ambiguity.

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/michaelkrauty/mcp-codesearch'

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