Skip to main content
Glama
Unified MCP Server

Unified MCP Server

by qingyunyupan

code_explain

Explains code logic and implementation details at beginner, intermediate, or expert depth for Python and JavaScript. Helps you understand complex code or explain it to others.

Instructions

详细解释代码的工作原理、逻辑流程和实现细节。适合学习理解复杂代码或向他人讲解代码功能。

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

Input Schema

NameRequiredDescriptionDefault
codeYes要解释的代码
levelNo解释详细程度intermediate
languageYes代码语言

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/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. It does disclose the shape of what is produced (working principle, logic flow, implementation details), which is the key behavioral trait for an explain tool, and the operation is evidently non-mutating. It says nothing about output length, structure, or how the 'level' setting changes the result, so a good part of the burden is unmet.

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?

Two sentences, purpose first and audience second, with no filler or repetition. The second sentence is somewhat soft ('适合...') but still carries routing information. Nothing needs to be cut, though nothing is exceptionally tight either.

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

Completeness4/5

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

This is a simple three-parameter tool with full schema coverage and no output schema, so the description only needs to establish purpose, audience, and output character. It does all three at a high level. The remaining gap is how the 'level' parameter shapes the explanation, which the agent must discover by calling.

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 both enums are documented in-schema, so the baseline is 3. The description adds no parameter-specific meaning: it never explains what 'beginner' vs 'expert' produces, nor any constraint on the code string. Nothing here compensates beyond or improves on the schema.

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 ('详细解释代码') and enumerates the facets covered: 工作原理, 逻辑流程, 实现细节. That is far more informative than the bare name 'code_explain'. It stops short of differentiating from adjacent siblings such as code_analyze or code_review, leaving the agent to infer the boundary.

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 a usage context (learning and teaching), so the when-to-use is implied rather than stated operationally. There is no guidance on when NOT to use it and no named alternative, which matters given the crowded code_* sibling set. The context is real but generic enough that an agent could not use it to rule out code_analyze.

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