Skip to main content
Glama

codebase_search

Search an indexed codebase semantically with natural-language queries to retrieve relevant code chunks; verify indexing status first.

Instructions

Semantic search across an indexed codebase. Only use after codebase_index is complete (check codebase_status first). Returns relevant code chunks matching a natural language query.

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

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of results to return. Default: 10 (override globally via SEARCH_DEFAULT_LIMIT env var).
queryYesNatural language search query (e.g. 'authentication middleware', 'database connection setup').
minScoreNoMinimum RRF score threshold (0-1). Results below this are filtered out. Default: 0.10 (override globally via SEARCH_MIN_SCORE env var). Set to 0 to disable filtering.
fileFilterNoFilter results to one file, given exactly as a result header shows its path (e.g. 'src/index.ts'). Directories, globs, lists and bare names of files below the root match nothing.
projectPathNoAbsolute path to the project directory.
includeLinkedNoWhen true, also search across linked projects defined in .socraticode.json or SOCRATICODE_LINKED_PROJECTS env var. Results include a project label showing which project each result came from. Default: false.
languageFilterNoFilter results to one language, given exactly as a result header shows its label in brackets (e.g. 'typescript', 'python', 'go'); aliases such as 'ts' or 'py' match nothing.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.16.2
    • changedInput schema / properties / fileFilter / description
      Previous value: -"Filter results to a specific file path (relative)."New value: +"Filter results to one file, given exactly as a result header shows its path (e.g. 'src/index.ts'). Directories, globs, lists and bare names of files below the root match nothing."
    • changedInput schema / properties / languageFilter / description
      Previous value: -"Filter results to a specific language (e.g. 'typescript', 'python')."New value: +"Filter results to one language, given exactly as a result header shows its label in brackets (e.g. 'typescript', 'python', 'go'); aliases such as 'ts' or 'py' match nothing."
  2. Addedv1.8.2
  3. Removedv1.8.1
  4. Addedv1.7.2

TDQS

A3.8/5.0
Behavior3/5

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

No annotations exist, so the description carries the burden. It correctly discloses the indexing prerequisite and the semantic-match nature of results, but says nothing about result ordering, score meaning, payload shape, or cost/latency, leaving real behavioral gaps for a 7-parameter search tool.

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 tight sentences: what it does, the gating prerequisite, and what comes back. The critical constraint is front-loaded and nothing is redundant.

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 read-only search over an indexed project, the description plus a fully documented schema covers invocation correctly. The only missing piece is what a result looks like, which matters somewhat since filters reference 'result headers' but no output schema exists to define them.

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%, including defaults, env-var overrides, RRF score range, and strict fileFilter/languageFilter matching rules, so the schema does the heavy lifting. The description adds no parameter-level meaning beyond restating that the query is natural language.

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?

States a specific verb and resource ('Semantic search across an indexed codebase') plus the return type ('relevant code chunks matching a natural language query'). It is distinguishable from graph/impact siblings, though it does not differentiate itself from the close-sounding codebase_context_search or codebase_symbols.

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?

Gives an explicit precondition and even names the sibling to check ('Only use after codebase_index is complete (check codebase_status first)'). There is no statement of when NOT to use it or which sibling to prefer for symbol/graph lookups, so it stops short of full routing guidance.

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