Skip to main content
Glama

pg_search_code

Find code symbols, camelCase or snake_case substrings, and query matches across Python, TS/JS, Go, Rust, and other languages using hybrid BM25 and trigram ranking.

Instructions

Hybrid SQLite FTS5 (BM25 symbol + trigram substring RRF) code search across Python, TS/JS, Go, Rust, etc.

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

Input Schema

NameRequiredDescriptionDefault
slotNoWorkspace slot name (optional if only one slot is open or `--slot` default is set).
limitNoMax hits to return (default: 10).
queryYesSymbol name, camelCase/snake_case substring, or code query.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv4.7.1

TDQS

C2.9/5.0
Behavior2/5

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

No annotations and no output schema, so the description carries the full burden, but it only discloses implementation internals (FTS5, BM25, trigram, RRF). It does not say whether this is purely lexical, how hits are ranked or truncated, whether snippets/line numbers come back, or what scope (whole workspace vs. slot) is searched.

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?

A single front-loaded sentence with no filler. However, acronyms like 'BM25' and 'RRF' consume space that could have described observable behavior such as ranking or result shape.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter search tool with no output schema and no annotations, the description leaves out the return shape, ranking semantics, and workspace/slot scoping. It conveys enough to attempt a call but not enough to predict or interpret results.

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 the schema already documents query, limit, and slot, and the baseline is 3. The description's mention of 'symbol name, camelCase/snake_case substring' roughly restates the query parameter and adds no new syntax or format guidance. 'Hybrid' implies both symbol and substring matching work, which is a mild hint but not actionable detail.

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?

The description names a specific verb+resource ('code search') and scopes it to concrete languages (Python, TS/JS, Go, Rust). It does not differentiate from plausible siblings such as pg_code_graph or pg_test_impact, so the agent cannot rule those out from the text alone.

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

Usage Guidelines2/5

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

There is no when-to-use guidance, no exclusion of alternatives, and no stated preconditions (e.g., that a slot must be open). The agent must guess whether this is the right tool for a given lookup versus the graph or test tools.

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