Skip to main content
Glama
onion-ai

onion-mcp-server

Official
by onion-ai

code_fix

Fix code errors by providing the code and optionally the error message for improved accuracy. Supports multiple languages.

Instructions

修复代码中的错误,可提供错误信息以提高准确性。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
error_messageNo
languageNo

Implementation Reference

  • Handler logic for the 'code_fix' tool: builds a prompt to fix code errors and delegates to llm_call.
    elif name == "code_fix":
        err_part = f"\n\n错误信息:\n```\n{a['error_message']}\n```" if a.get("error_message") else ""
        lang     = a.get("language", "") or ""
        prompt = (
            f"请修复以下 {lang} 代码中的错误。\n"
            f"要求:输出修复后的完整代码,并在代码前简要说明修复了什么问题。\n\n"
            f"```\n{a['code']}\n```{err_part}"
        )
  • Schema definition for 'code_fix': requires 'code', optional 'error_message' and 'language'.
    types.Tool(
        name="code_fix",
        description="修复代码中的错误,可提供错误信息以提高准确性。",
        inputSchema={
            "type": "object",
            "properties": {
                "code":          {"type": "string"},
                "error_message": {"type": "string", "default": ""},
                "language":      {"type": "string", "default": ""},
            },
            "required": ["code"],
        },
    ),
  • Registration: maps 'code_fix' (via CODE_TOOLS) to handle_code in the server's routing table.
    for _t in CODE_TOOLS:   
        _HANDLERS[_t.name] = handle_code
  • Helper function 'llm_call' used by handle_code to send the prompt to the LLM.
    async def llm_call(
        prompt: str,
        system: Optional[str] = None,
        temperature: float = 0.7,
    ) -> str:
        """单轮调用"""
        messages = []
        if system:
            messages.append({"role": "system", "content": system})
        messages.append({"role": "user", "content": prompt})
        return await llm_chat(messages, temperature=temperature)
Behavior1/5

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

No annotations are provided, and the description fails to disclose behavioral traits such as side effects, limitations, or what kind of errors it can fix. It merely states the action without elaboration.

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 description is a single sentence, which is concise, but it could be more informative without being verbose. It lacks structure and important details.

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

Completeness1/5

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

Given no output schema, no annotations, and minimal parameter info, the description is severely incomplete. It does not explain return values, supported languages, or constraints, making it hard for an agent to rely on.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%. The description only hints at the error_message parameter by mentioning error info. It does not explain the 'code' or 'language' parameters, leaving their semantics unclear.

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 clearly states the tool fixes code errors and that providing error info improves accuracy. However, it does not differentiate from sibling tools like code_review which may also address errors.

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?

Only a vague hint about providing error info is given. No explicit guidance on when to use this tool versus alternatives like code_review or code_generate, nor any exclusions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/onion-ai/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server