Skip to main content
Glama

Memoria — Deterministic AI Memory & Code Intelligence MCP

Explain Code Symbol

explain_code
Read-onlyIdempotent

Synthesize definitions, caller/callee references, related tests, and architectural notes for a specific code symbol in a namespace (read-only, idempotent; consumes 1 Read API call) and return { results, total_candidates } (up to 20 ranked matches). Pass the identifier via symbol or its equivalent alias target (if both are supplied, symbol takes precedence). Use before editing a known function, class, or module to check its blast radius and invariants; use search_code instead when you only have keywords and need to find symbol names first.

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>"
    },
    "name": "explain_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
symbolNoExact function, class, or module name to explain (preferred; equivalent to target).
targetNoAlias for symbol accepted for client compatibility when symbol is omitted.
namespaceYesLogical repository or workspace namespace containing indexed code memories.

Output Schema

NameRequiredDescriptionDefault
resultsYesRanked { memory, score } symbol definitions, callers, and architectural rules (max 20).
total_candidatesYesTotal namespace candidates evaluated.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / namespace / description
      Previous value: -"Workspace namespace to search."New value: +"Logical repository or workspace namespace containing indexed code memories."
    • changedInput schema / properties / symbol / description
      Previous value: -"Symbol or module identifier to explain."New value: +"Exact function, class, or module name to explain (preferred; equivalent to target)."
    • changedInput schema / properties / target / description
      Previous value: -"Alias for symbol identifier to explain."New value: +"Alias for symbol accepted for client compatibility when symbol is omitted."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "results": {
      +      "description": "Ranked { memory, score } symbol definitions, callers, and architectural rules (max 20).",
      +      "items": {
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "total_candidates": {
      +      "description": "Total namespace candidates evaluated.",
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "results",
      +    "total_candidates"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world, and the description partly restates that. It still earns credit for context annotations do not carry: the cost signal ("consumes 1 Read API call") and the result-ranking cap ("up to 20 ranked matches"). It does not discuss failure modes such as an unresolvable symbol or an unknown namespace, which keeps it below 5.

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?

Front-loaded with purpose and output shape, then supporting rules and routing guidance; no throwaway sentences. The opening sentence is long and stacks several clauses, which costs a bit of scannability.

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, output shape, parameter precedence, and sibling routing for a straightforward three-parameter read tool. An agent has everything needed to decide between this and search_code and to invoke it correctly on the first try.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds a genuine rule the schema only implies: when both symbol and target are supplied, symbol takes precedence. The remaining parameter meaning (namespace as the logical repository/workspace container) is already carried by the schema.

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 ("Synthesize") applied to a specific resource ("a specific code symbol in a namespace") and enumerates exactly what is aggregated: definitions, caller/callee references, related tests, architectural notes. It also explicitly distinguishes itself from search_code by naming that sibling in the same description.

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 a concrete when-to-use ("before editing a known function, class, or module to check its blast radius and invariants") and a concrete when-not/alternative ("use search_code instead when you only have keywords and need to find symbol names first"). The condition that selects the alternative is explicit rather than inferred.

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.