Skip to main content
Glama
kvnpetit

SRC (Structured Repo Context)

by kvnpetit

search_code

search_code
Read-onlyIdempotent

Find code by natural language meaning using hybrid vector/keyword search, with deterministic reranking and caller/callee context. Locates relevant functions and files by concept, not just exact terms.

Instructions

Search code semantically using natural language queries, hybrid vector/BM25 retrieval, and deterministic identifier reranking. USE THIS to find code by concept/meaning (e.g., 'authentication logic', 'error handling'). Requires index_codebase first. Returns relevant code chunks with file locations, function names, and call relationships (who calls what).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoSearch mode: 'vector' (semantic only), 'fts' (keyword only), 'hybrid' (combined with RRF fusion)hybrid
limitNoMaximum number of results to return
queryYesNatural language search query
cursorNoOpaque cursor returned by a previous search page
rerankNoOptional deterministic reranking: lexical or code-aware symbol/signature ranking without another modellexical
languageNoFilter results to one detected language
directoryNoPath to the indexed directory (defaults to current directory).
thresholdNoMaximum distance threshold for results (lower = more similar)
path_prefixNoFilter results to a project-relative path prefix
symbol_typeNoFilter results to a symbol kind such as function or class
vectorWeightNoHybrid RRF weight for semantic vector results (0 = keyword only, 1 = vector only)
include_testsNoWhether test/spec paths are eligible (default: true)
min_confidenceNoOptional local confidence floor; above it the tool may abstain
redact_secretsNoRedact common inline secrets in returned source (default: true)
neighbor_windowNoOptional bounded same-file context window in chunks on each side of a hit (0 disables it)
max_content_bytesNoMaximum UTF-8 bytes returned for each source result (default: 20000)
includeCallContextNoInclude caller/callee information for each result (uses cached call graph)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
metaYes
errorNo
messageNo
successYes
schema_versionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed14 schema fields changedv2.0.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "Opaque cursor returned by a previous search page",
      +  "maxLength": 1024,
      +  "type": "string"
      +}
    • addedInput schema / properties / include_tests
      Added value: +{
      +  "default": true,
      +  "description": "Whether test/spec paths are eligible (default: true)",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / language
      Added value: +{
      +  "description": "Filter results to one detected language",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / properties / limit / maximum
      Previous value: -9007199254740991New value: +100
    • addedInput schema / properties / max_content_bytes
      Added value: +{
      +  "default": 20000,
      +  "description": "Maximum UTF-8 bytes returned for each source result (default: 20000)",
      +  "exclusiveMinimum": 0,
      +  "maximum": 100000,
      +  "type": "integer"
      +}
    • addedInput schema / properties / min_confidence
      Added value: +{
      +  "default": 0,
      +  "description": "Optional local confidence floor; above it the tool may abstain",
      +  "maximum": 1,
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / neighbor_window
      Added value: +{
      +  "default": 0,
      +  "description": "Optional bounded same-file context window in chunks on each side of a hit (0 disables it)",
      +  "maximum": 3,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / path_prefix
      Added value: +{
      +  "description": "Filter results to a project-relative path prefix",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / redact_secrets
      Added value: +{
      +  "default": true,
      +  "description": "Redact common inline secrets in returned source (default: true)",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / rerank
      Added value: +{
      +  "default": "lexical",
      +  "description": "Optional deterministic reranking: lexical or code-aware symbol/signature ranking without another model",
      +  "enum": [
      +    "none",
      +    "lexical",
      +    "code"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / symbol_type
      Added value: +{
      +  "description": "Filter results to a symbol kind such as function or class",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / vectorWeight
      Added value: +{
      +  "default": 0.5,
      +  "description": "Hybrid RRF weight for semantic vector results (0 = keyword only, 1 = vector only)",
      +  "maximum": 1,
      +  "minimum": 0,
      +  "type": "number"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "data": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "cursor_offset": {
      +          "maximum": 9007199254740991,
      +          "minimum": 0,
      +          "type": "integer"
      +        },
      +        "directory": {
      +          "type": "string"
      +        },
      +        "filters": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "include_tests": {
      +              "type": "boolean"
      +            },
      +            "language": {
      +              "type": "string"
      +            },
      +            "path_prefix": {
      +              "type": "string"
      +            },
      +            "symbol_type": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "include_tests"
      +          ],
      +          "type": "object"
      +        },
      +        "index": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "embedding_dimensions": {
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "embedding_model": {
      +              "type": "string"
      +            },
      +            "embedding_provider": {
      +              "type": "string"
      +            },
      +            "schema_version": {
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "source_fingerprint": {
      +              "type": "string"
      +            },
      +            "updated_at": {
      +              "type": "string"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "instruction_signals": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "count": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "detected": {
      +              "type": "boolean"
      +            },
      +            "kinds": {
      +              "items": {
      +                "enum": [
      +                  "instruction_override",
      +                  "authority_spoofing",
      +                  "tool_execution_request",
      +                  "secret_exfiltration_request",
      +                  "delimiter_spoofing",
      +                  "hidden_unicode",
      +                  "encoded_instruction"
      +                ],
      +                "type": "string"
      +              },
      +              "type": "array"
      +            },
      +            "scan_truncated": {
      +              "type": "boolean"
      +            },
      +            "scanned_bytes": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "signals": {
      +              "items": {
      +                "additionalProperties": false,
      +                "properties": {
      +                  "column": {
      +                    "maximum": 9007199254740991,
      +                    "minimum": 0,
      +                    "type": "integer"
      +                  },
      +                  "confidence": {
      +                    "maximum": 1,
      +                    "minimum": 0,
      +                    "type": "number"
      +                  },
      +                  "kind": {
      +                    "enum": [
      +                      "instruction_override",
      +                      "authority_spoofing",
      +                      "tool_execution_request",
      +                      "secret_exfiltration_request",
      +                      "delimiter_spoofing",
      +                      "hidden_unicode",
      +                      "encoded_instruction"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "line": {
      +                    "exclusiveMinimum": 0,
      +                    "maximum": 9007199254740991,
      +                    "type": "integer"
      +                  },
      +                  "offset": {
      +                    "maximum": 9007199254740991,
      +                    "minimum": 0,
      +                    "type": "integer"
      +                  },
      +                  "reason": {
      +                    "type": "string"
      +                  },
      +                  "source": {
      +                    "type": "string"
      +                  }
      +                },
      +                "required": [
      +                  "kind",
      +                  "line",
      +                  "column",
      +                  "offset",
      +                  "confidence",
      +                  "reason"
      +                ],
      +                "type": "object"
      +              },
      +              "type": "array"
      +            }
      +          },
      +          "required": [
      +            "detected",
      +            "count",
      +            "kinds",
      +            "signals",
      +            "scanned_bytes",
      +            "scan_truncated"
      +          ],
      +          "type": "object"
      +        },
      +        "next_cursor": {
      +          "type": "string"
      +        },
      +        "query": {
      +          "type": "string"
      +        },
      +        "results": {
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "callContext": {
      +                "additionalProperties": false,
      +                "properties": {
      +                  "callees": {
      +                    "items": {
      +                      "type": "string"
      +                    },
      +                    "type": "array"
      +                  },
      +                  "callers": {
      +                    "items": {
      +                      "type": "string"
      +                    },
      +                    "type": "array"
      +                  }
      +                },
      +                "required": [
      +                  "callers",
      +                  "callees"
      +                ],
      +                "type": "object"
      +              },
      +              "confidence": {
      +                "maximum": 1,
      +                "minimum": 0,
      +                "type": "number"
      +              },
      +              "content": {
      +                "type": "string"
      +              },
      +              "content_truncated": {
      +                "type": "boolean"
      +              },
      +              "endLine": {
      +                "exclusiveMinimum": 0,
      +                "maximum": 9007199254740991,
      +                "type": "integer"
      +              },
      +              "filePath": {
      +                "type": "string"
      +              },
      +              "is_neighbor": {
      +                "type": "boolean"
      +              },
      +              "language": {
      +                "type": "string"
      +              },
      +              "neighbor_distance": {
      +                "exclusiveMinimum": 0,
      +                "maximum": 9007199254740991,
      +                "type": "integer"
      +              },
      +              "neighbor_of": {
      +                "type": "string"
      +              },
      +              "parts": {
      +                "additionalProperties": false,
      +                "properties": {
      +                  "body": {
      +                    "type": "string"
      +                  },
      +                  "documentation": {
      +                    "type": "string"
      +                  },
      +                  "signature": {
      +                    "type": "string"
      +                  }
      +                },
      +                "required": [
      +                  "body"
      +                ],
      +                "type": "object"
      +              },
      +              "score": {
      +                "type": "number"
      +              },
      +              "startLine": {
      +                "exclusiveMinimum": 0,
      +                "maximum": 9007199254740991,
      +                "type": "integer"
      +              },
      +              "symbolName": {
      +                "type": "string"
      +              },
      +              "symbolType": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "filePath",
      +              "language",
      +              "startLine",
      +              "endLine",
      +              "content",
      +              "score",
      +              "confidence",
      +              "parts"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "resultsCount": {
      +          "maximum": 9007199254740991,
      +          "minimum": 0,
      +          "type": "integer"
      +        },
      +        "retrieval": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "abstained": {
      +              "type": "boolean"
      +            },
      +            "abstention_reason": {
      +              "type": "string"
      +            },
      +            "candidates_considered": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "content_limit_bytes": {
      +              "exclusiveMinimum": 0,
      +              "maximum": 9007199254740991,
      +              "type": "integer"
      +            },
      +            "content_truncated_count": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "duplicates_removed": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "min_confidence": {
      +              "maximum": 1,
      +              "minimum": 0,
      +              "type": "number"
      +            },
      +            "neighbor_candidates_considered": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "neighbor_window": {
      +              "maximum": 3,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "neighbors_added": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "neighbors_truncated": {
      +              "type": "boolean"
      +            },
      +            "query_kind": {
      +              "enum": [
      +                "identifier",
      +                "concept",
      +                "mixed"
      +              ],
      +              "type": "string"
      +            },
      +            "reranker": {
      +              "enum": [
      +                "none",
      +                "lexical",
      +                "code"
      +              ],
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "query_kind",
      +            "reranker",
      +            "candidates_considered",
      +            "duplicates_removed",
      +            "min_confidence",
      +            "abstained",
      +            "content_limit_bytes",
      +            "content_truncated_count",
      +            "neighbor_window",
      +            "neighbors_added",
      +            "neighbor_candidates_considered",
      +            "neighbors_truncated"
      +          ],
      +          "type": "object"
      +        },
      +        "secrets_redacted": {
      +          "type": "boolean"
      +        },
      +        "source_is_untrusted": {
      +          "const": true,
      +          "type": "boolean"
      +        },
      +        "truncated": {
      +          "type": "boolean"
      +        }
      +      },
      +      "required": [
      +        "query",
      +        "directory",
      +        "resultsCount",
      +        "truncated",
      +        "cursor_offset",
      +        "retrieval",
      +        "filters",
      +        "index",
      +        "source_is_untrusted",
      +        "secrets_redacted",
      +        "instruction_signals",
      +        "results"
      +      ],
      +      "type": "object"
      +    },
      +    "error": {
      +      "type": "string"
      +    },
      +    "message": {
      +      "type": "string"
      +    },
      +    "meta": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "bounded": {
      +          "const": true,
      +          "type": "boolean"
      +        },
      +        "confidence": {
      +          "maximum": 1,
      +          "minimum": 0,
      +          "type": "number"
      +        },
      +        "coverage": {
      +          "enum": [
      +            "precise",
      +            "approximate",
      +            "unknown"
      +          ],
      +          "type": "string"
      +        },
      +        "generated_at": {
      +          "type": "string"
      +        },
      +        "index_freshness": {
      +          "enum": [
      +            "fresh",
      +            "stale",
      +            "unknown"
      +          ],
      +          "type": "string"
      +        },
      +        "instruction_signals": {
      +          "additionalProperties": false,
      +          "properties": {
      +            "count": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "detected": {
      +              "type": "boolean"
      +            },
      +            "kinds": {
      +              "items": {
      +                "enum": [
      +                  "instruction_override",
      +                  "authority_spoofing",
      +                  "tool_execution_request",
      +                  "secret_exfiltration_request",
      +                  "delimiter_spoofing",
      +                  "hidden_unicode",
      +                  "encoded_instruction"
      +                ],
      +                "type": "string"
      +              },
      +              "type": "array"
      +            },
      +            "scan_truncated": {
      +              "type": "boolean"
      +            },
      +            "scanned_bytes": {
      +              "maximum": 9007199254740991,
      +              "minimum": 0,
      +              "type": "integer"
      +            },
      +            "signals": {
      +              "items": {
      +                "additionalProperties": false,
      +                "properties": {
      +                  "column": {
      +                    "maximum": 9007199254740991,
      +                    "minimum": 0,
      +                    "type": "integer"
      +                  },
      +                  "confidence": {
      +                    "maximum": 1,
      +                    "minimum": 0,
      +                    "type": "number"
      +                  },
      +                  "kind": {
      +                    "enum": [
      +                      "instruction_override",
      +                      "authority_spoofing",
      +                      "tool_execution_request",
      +                      "secret_exfiltration_request",
      +                      "delimiter_spoofing",
      +                      "hidden_unicode",
      +                      "encoded_instruction"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "line": {
      +                    "exclusiveMinimum": 0,
      +                    "maximum": 9007199254740991,
      +                    "type": "integer"
      +                  },
      +                  "offset": {
      +                    "maximum": 9007199254740991,
      +                    "minimum": 0,
      +                    "type": "integer"
      +                  },
      +                  "reason": {
      +                    "type": "string"
      +                  },
      +                  "source": {
      +                    "type": "string"
      +                  }
      +                },
      +                "required": [
      +                  "kind",
      +                  "line",
      +                  "column",
      +                  "offset",
      +                  "confidence",
      +                  "reason"
      +                ],
      +                "type": "object"
      +              },
      +              "type": "array"
      +            }
      +          },
      +          "required": [
      +            "detected",
      +            "count",
      +            "kinds",
      +            "signals",
      +            "scanned_bytes",
      +            "scan_truncated"
      +          ],
      +          "type": "object"
      +        },
      +        "local_only": {
      +          "const": true,
      +          "type": "boolean"
      +        },
      +        "provenance": {
      +          "enum": [
      +            "local-analysis",
      +            "local-filesystem",
      +            "local-index",
      +            "local-lsp"
      +          ],
      +          "type": "string"
      +        },
      +        "source_is_untrusted": {
      +          "type": "boolean"
      +        },
      +        "source_revision": {
      +          "type": "string"
      +        },
      +        "truncated": {
      +          "type": "boolean"
      +        }
      +      },
      +      "required": [
      +        "generated_at",
      +        "local_only",
      +        "bounded",
      +        "provenance"
      +      ],
      +      "type": "object"
      +    },
      +    "schema_version": {
      +      "const": 1,
      +      "type": "number"
      +    },
      +    "success": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "schema_version",
      +    "success",
      +    "meta"
      +  ],
      +  "type": "object"
      +}
  2. First observedv1.0.3

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already mark the tool as read-only, idempotent, and non-destructiveable. The description adds meaningful behavior beyond this: it requires a prior indexing step, returns code chunks with file locations/function names/call relationships, and uses deterministic reranking rather than an LLM. This gives an agent important operational context without contradicting the annotations.

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 sentences, front-loaded with the core action and an explicit use case. The directive 'USE THIS' is immediately actionable and every sentence adds value: what it does, when to use it, and what it requires. No filler or redundancy.

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 17-parameter tool with an output schema and rich annotations, the description covers the essential operational context: purpose, usage trigger, prerequisite, and return contents. It doesn't guide parameter selection among the many filters, but the schema descriptions already document those behaviors. A small gap remains around expected latency or result formatting, though the output schema mitigates this.

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% with detailed descriptions for all 17 parameters. The description mentions high-level concepts like hybrid vector/BM25, reranking, and call relationships that map to mode, rerank, and includeCallContext, but it doesn't explain parameter syntax or behavior beyond the schema. Baseline 3 is appropriate since the schema carries the parameter semantics.

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 states a specific verb and resource: 'Search code semantically' using natural language queries accruing hybrid vector/BM25 and reranking. It explicitly contrasts with symbol-based tools by targeting 'concept/meaning' and gives concrete examples like 'authentication logic'. This clearly differentiates it from siblings such as find_symbols or query_code.

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?

The description provides an explicit usage directive: 'USE THIS to find code by concept/meaning' with examples and a clear prerequisite ('Requires index_codebase first'). It does not name sibling alternatives or specify when to use a different tool, so it stops short of full when/when-not guidance.

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