Skip to main content
Glama

local_explain_code

Read-only

Explains code files or snippets in prose for explanation only using a local model, reading files server-side to keep large content out of context and save quota.

Instructions

PREFER this tool over reading the file with Read when the file is large (>200 lines / >10 KB) and you only need an explanation, not the literal content.

Explains in prose what a code snippet/file does, with a local code model.

Pass 'path' to read the file server-side (the full code does NOT enter Claude's context; only
the explanation comes back) or 'code'. Optionally focus the explanation with 'question'.
With 'path' the model sees the file's line numbers, so it can answer where something is
("name: line") and you can then Read only that range with offset/limit. With 'path' and a
'question', the server then checks those numbers against the file: cited lines that do not
contain what they are cited for get a warning, and each code identifier of the question
(`name`, name(), camelCase, snake_case) gets its exact lines, found by whole-word search.
Review the explanation: a local model writes it; the occurrence lines are exact.

Args:
    code: Code to explain (use this or 'path').
    path: Path to a code file (read server-side).
    question: Concrete question or focus (optional).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "local_explain_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNo
pathNo
questionNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.5/5.0
Behavior4/5

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

Goes well beyond the readOnlyHint/openWorldHint annotations: it discloses that the file is read server-side so the full code does NOT enter context, that a local model (not Claude) writes the explanation, and that with 'path'+'question' the server verifies cited line numbers and emits warnings for mismatches. What is missing is failure behavior (e.g., path not found, model error) and whether warnings change the return shape.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The PREFER directive is correctly front-loaded, but the body repeats itself: the local-model caveat appears twice ('with a local code model' and 'a local model writes it'), and the server-side/no-context fact is restated in the Args block. The dense multi-clause sentences about line-number verification are informative but hard to parse on one pass.

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?

For a 3-parameter, non-destructive tool with an output schema (so return values need no explanation), the description covers selection criteria, parameter behavior, context/privacy implications, and output trust caveats. An agent has everything needed to choose it and call it correctly.

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?

With 0% schema description coverage the description must carry the burden and largely does: it explains what each of code/path/question means and, crucially, the behavioral consequences of 'path' (server-side read, line numbers visible) and of 'question' (citation verification, identifier occurrence lookup). The gap is that all 3 params are optional and the description never states what happens if neither 'code' nor 'path' is supplied, nor that they are mutually exclusive.

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 opening sentence gives a specific verb and resource ('Explains in prose what a code snippet/file does') plus the mechanism ('a local code model'). It also distinguishes itself from a non-sibling alternative (Read) and implicitly from the local_summarize/local_delegate family by framing itself as code explanation with line-citation output.

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?

Explicit when-to-use ('PREFER this tool ... when the file is large (>200 lines / >10 KB) and you only need an explanation, not the literal content') with concrete thresholds and a named alternative (Read) plus the condition that selects it. It also implies when-not: when the literal content is what you need.

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