Skip to main content
Glama

Memoria — Deterministic AI Memory & Code Intelligence MCP

Search Indexed Code Memories

search_code
Read-onlyIdempotent

Search indexed code symbol definitions, file paths, and reference memories within a namespace (read-only, idempotent; consumes 1 Read API call) and return { results, total_candidates } capped at 20 ranked { memory, score } hits. Requires code memories in namespace (populated via /memoreal-sync-code or encode_memory) and rejects reserved "org:" prefixes. Use to discover where functions, classes, or routes live by keyword; use explain_code instead to inspect callers and invariants of a known symbol, or recall_memories for general prose rules.

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": {
      "namespace": "<namespace>",
      "query": "<query>"
    },
    "name": "search_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesFunction, class, route, or file keyword to locate.
namespaceYesLogical repository or workspace namespace to search (never prefix with "org:").

Output Schema

NameRequiredDescriptionDefault
resultsYesTop ranked { memory, score } code hits (max 20).
total_candidatesYesTotal candidate entries scanned in the namespace.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / namespace / description
      Previous value: -"Workspace namespace to search."New value: +"Logical repository or workspace namespace to search (never prefix with \"org:\")."
    • changedInput schema / properties / query / description
      Previous value: -"Symbol name or code query."New value: +"Function, class, route, or file keyword to locate."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "results": {
      +      "description": "Top ranked { memory, score } code hits (max 20).",
      +      "items": {
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "total_candidates": {
      +      "description": "Total candidate entries scanned in the namespace.",
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "results",
      +    "total_candidates"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Beyond the annotations, it discloses cost (consumes 1 Read API call), a result cap of 20 ranked hits, the population precondition via /memoreal-sync-code or encode_memory, and a rejection rule for reserved "org:" prefixes. The return shape it cites is partly redundant with the output schema, which slightly weakens the added value over structured fields.

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?

Purpose is front-loaded and every clause carries information, but the first sentence is a long run-on with stacked parentheticals that could be split. The remaining sentences are tight and purposeful.

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 purpose, cost, result cap, prerequisites, error behavior, and sibling routing, which is everything an agent needs before calling a read-only search. The presence of an output schema means return values need no further explanation.

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 coverage is 100%, so the schema already documents both parameters, and the description's note about the "org:" prefix restriction largely restates the schema's own guidance. It adds only the framing that query is keyword-based across functions, classes, routes, and files, which is a marginal gain over baseline.

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?

States a specific verb (search) over specific resources (indexed code symbol definitions, file paths, reference memories) scoped to a namespace, and explicitly distinguishes itself from explain_code and recall_memories. An agent can pick it out of the sibling list without opening any schema.

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

Usage Guidelines5/5

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

Gives an explicit positive case (discover where functions, classes, or routes live by keyword) and two named alternatives with the conditions that select them: explain_code for callers and invariants of a known symbol, recall_memories for general prose rules. It also states the prerequisite that code memories must already exist in the namespace.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.