Skip to main content
Glama

local_explain_code

Read-only

Explains code files or snippets in prose with a local model, reading files server-side to keep large code out of context and optionally answering a focused question.

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.
Review the explanation: a local model writes it.

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

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.9/5.0
Behavior5/5

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

Annotations already declare readOnlyHint and openWorldHint=false, and the description adds meaningfully beyond them: the file is read server-side, the full code does not enter Claude's context, only the explanation returns, the model sees line numbers, and the output is written by a local model that should be reviewed. That quality caveat and the context-cost behavior are exactly the traits an agent needs and cannot get from 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?

Front-loaded with the PREFER directive and the size threshold, then the mechanism, then the params. The Args block repeats some prose, but each line adds usable detail and nothing is filler.

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?

Output schema exists, so return values need not be described, and the description still covers inputs, server-side reading behavior, the line-number affordance, and the reliability caveat. Nothing an agent needs to call this correctly is missing.

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 0%, so the description must compensate, and its Args block documents all three parameters and the mutual exclusivity of 'code' vs 'path'. It does not say what happens when neither is supplied, a small gap given all params are optional.

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 and resource ('Explains in prose what a code snippet/file does') and distinguishes itself from the sibling read path ('PREFER this tool over reading the file with Read'). An agent can pick this over Read 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 explicit selection conditions: prefer it when the file is large (>200 lines / >10 KB) and only an explanation is needed rather than literal content. It also names the alternative (Read) and the follow-up workflow (read only the cited line range with offset/limit).

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