Skip to main content
Glama

Semantic Code Search

semantic_search

Search a codebase using natural language to find relevant implementations, usage patterns, and related code by meaning rather than keywords; indexes on first use.

Instructions

Search code semantically using natural language queries. Finds relevant code by understanding meaning, not just keywords. Useful for finding implementations, usage patterns, or related code. On first use, indexes the codebase (may take a moment for large projects).

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

Input Schema

NameRequiredDescriptionDefault
pathNoOptional directory path to scope the search
limitNoMaximum number of results to return (default: 10)
queryYesNatural language query describing what you are looking for
file_patternNoOptional glob pattern to filter files (e.g., "*.ts", "**/*.py")
use_rerankingNoUse cross-encoder reranking for better precision (default: true)
candidate_multiplierNoCandidate multiplier for reranking, 1-20 (default: 5)

Output Schema

NameRequiredDescriptionDefault
queryYesThe original search query
resultsYesArray of matching code chunks
totalResultsYesNumber of results returned

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.1

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose one important side effect: first-use indexing that 'may take a moment for large projects.' That is genuinely useful, but permission requirements, index persistence/freshness, and latency behavior for subsequent calls are unstated.

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?

Four short sentences, front-loaded with purpose and mechanism before the usage hints and the indexing caveat. Nothing is padded, though the sentences are somewhat list-like rather than prioritised.

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?

An output schema exists, so return values need not be explained, and the six parameters are fully documented in the schema. The description covers purpose, typical uses, and the notable first-run indexing cost, leaving only minor gaps such as index staleness and permissions.

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 all six parameters including path, file_pattern, and reranking options are already documented in the schema. The description adds no meaning beyond that, so the baseline 3 applies.

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 ('Search code semantically') and distinguishes the mechanism from keyword search ('understanding meaning, not just keywords'). It is clear to an agent what the tool does, though with no siblings listed there is no explicit contrast to another tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Useful for finding implementations, usage patterns, or related code' gives implied usage contexts, but there is no when-not guidance and no named alternative for keyword or exact-match lookups. The agent must infer the boundary itself.

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

Deploy Server

Other Tools