Skip to main content
Glama

Explains a code snippet: detected language, a summary

code_explain
Read-only

Explains a code snippet (max 20,000 characters): detected language, a summary, a step-by-step explanation, the functions and classes it defines, and possible bugs and security issues with line numbers. Line numbers outside the snippet are dropped. Model-written: a finding is a lead to check, not a verified defect. Price: $0.002 per successful call, paid with x402 (USDC on Base, Solana and 10 more networks); failed calls are not charged.

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": "code_explain"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesSource code snippet (max 20,000 characters)
languageNoLanguage if you know it (optional; otherwise detected)

Output Schema

NameRequiredDescriptionDefault
noteNo
linesNo
stepsNo
issuesNo
summaryNo
languageNo
checkedAtNo
functionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • addedOutput schema / properties / checkedAt
      Added value: +{}
    • addedOutput schema / properties / functions
      Added value: +{}
    • addedOutput schema / properties / issues
      Added value: +{}
    • addedOutput schema / properties / language
      Added value: +{}
    • addedOutput schema / properties / lines
      Added value: +{}
    • addedOutput schema / properties / note
      Added value: +{}
    • addedOutput schema / properties / steps
      Added value: +{}
    • addedOutput schema / properties / summary
      Added value: +{}
  2. Added

TDQS

A4.4/5.0
Behavior5/5

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

Goes well beyond the readOnlyHint/openWorldHint annotations: it discloses that model-written findings are leads rather than verified defects, that out-of-range line numbers are dropped, and the exact cost model ($0.002 per successful call via x402, failures free). The trust caveat and billing terms are behavior an agent could not infer from 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?

Front-loaded with the verb and the output list, then constraints, then trust caveat and price — a sensible information order with no filler sentences. The payment/network enumeration is slightly verbose but is genuinely decision-relevant.

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 limits, output shape, reliability caveat, and cost, which is more than enough for a two-parameter read-only tool that already has an output schema and safety annotations. Nothing needed to call it 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 100%, so the baseline is 3; the description additionally clarifies that 'language' is optional because it is otherwise detected, and restates the character ceiling that bounds the 'code' parameter. That said, much of this repeats schema text rather than adding new meaning.

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 a code snippet') and enumerates the exact outputs: detected language, summary, step-by-step explanation, defined functions/classes, and bugs/security issues with line numbers. An agent knows precisely what this produces before opening the schema.

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

Usage Guidelines3/5

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

Gives the hard constraint (max 20,000 characters) and the truncation rule for line numbers, which sets usage boundaries. However, it never says when to prefer this tool over alternatives or what preconditions make it a bad fit, so selection guidance is only implied.

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.

Resources