Skip to main content
Glama

explain-code

Analyzes source code to clarify its behavior and implementation, with optional language detection and adjustable detail levels.

Instructions

Explains what a piece of code does and how it works

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": {
      "code": "<code>"
    },
    "name": "explain-code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe code to explain
modelNoOptional model to use (e.g., 'qwen-turbo'). If not specified, uses the default model (qwen-plus).
languageNoProgramming language of the code (e.g., 'python', 'javascript', 'java', 'cpp'). If not specified, Qwen will try to detect it.
detailLevelNoLevel of detail for the explanationdetailed

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.1

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden and delivers almost none of it. It does not say the explanation is produced by a remote LLM call (implying latency and possible cost), nor does it describe the shape of the returned explanation or whether long code is truncated. The only behavioral hints, model selection and detail level, come from the schema rather than the description.

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?

A single ten-word sentence with no filler and the purpose stated up front. It earns its length but stops short of the point where additional routing or behavior detail would be genuinely useful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool takes four parameters, has no annotations and no output schema, so the description is the only place an agent can learn what comes back and how the tool behaves. It covers neither the return value (a prose explanation) nor the effect of detailLevel or the model choice on results, leaving a significant gap for a tool this simple to describe fully.

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% and every parameter, including the detailLevel enum and the model fallback to qwen-plus, is documented in the schema itself. The description adds no meaning beyond that, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and resource: it explains a piece of code, covering both 'what it does' and 'how it works'. That is enough to separate it from a code generator or refactorer, but it never explicitly distinguishes itself from the closely related review-code sibling, which an agent could easily confuse it with.

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

Usage Guidelines2/5

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

There is no when-to-use or when-not-to-use guidance at all. The description never says to prefer this over review-code for understanding versus finding defects, nor does it mention prerequisites such as supplying a language hint for unusual syntax.

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