Skip to main content
Glama

search_code

Find code patterns using grep and enrich results with a knowledge graph to deduplicate matches into functions, rank by importance, and limit by scope filters.

Instructions

Graph-augmented code search. Finds text patterns via grep, then enriches results with the knowledge graph: deduplicates matches into containing functions, ranks by structural importance (definitions first, popular functions next, tests last). Modes: compact (default, signatures only — token efficient), full (with source), files (just file paths). Use path_filter regex to scope results. TRUNCATION: enriched results are capped at limit (default 10). Response carries 'total_grep_matches' (raw grep hit count) and 'total_results' (deduplicated function count) — compare to limit to detect truncation. There is no offset parameter; to see more, raise limit or narrow the query with file_pattern / path_filter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYes
projectYes
file_patternNoGlob for grep --include (e.g. *.go)
path_filterNoRegex filter on result file paths (e.g. ^src/ or \.(go|ts)$)
modeNocompact: signatures+metadata (default). full: with source. files: just file list.compact
contextNoLines of context around each match (like grep -C). Only used in compact mode.
regexNo
limitNoMax enriched results per call. Default 10. Response includes 'total_grep_matches' and 'total_results' so callers can detect truncation. No offset parameter — raise limit or narrow with file_pattern / path_filter to see more.
Behavior5/5

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

Describes truncation behavior, response fields (total_grep_matches, total_results), deduplication logic, ranking by importance, and mode options. Since no annotations exist, the description fully covers behavioral traits.

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?

Efficiently structured: main purpose first, then modes, then truncation handling. Every sentence adds value without redundancy.

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?

Covers inputs (modes, filters), behavior (dedup, ranking), outputs (response fields, truncation detection), and limitations (no offset). No output schema needed as response is described.

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?

Adds significant meaning beyond schema: explains limit's truncation detection, context mode restriction, path_filter usage, and mode differences (compact token-efficient). For parameters like project and pattern, schema lacks description but the tool context implies their role.

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 performs 'Graph-augmented code search' and details the process: grep then knowledge graph enrichment. It distinguishes from sibling tools like search_graph and query_graph by focusing on code patterns and file paths.

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?

It provides explicit guidance on when to use the tool (for code search with graph context) and how to scope results using path_filter. It also advises on handling truncation by raising limit or narrowing filters, but does not explicitly contrast with sibling tools.

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/DeusData/codebase-memory-mcp'

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