Skip to main content
Glama
Unified MCP Server

Unified MCP Server

by qingyunyupan

code_improve

Refactor and optimize existing Python or JavaScript code for performance, readability, security, or maintainability, returning concrete suggestions and revised code.

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>",
      "goal": "<goal>"
    },
    "name": "code_improve"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes需要优化的代码
goalYes优化目标
languageYes代码语言

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/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. It does disclose that output includes both written suggestions and rewritten code, which is genuinely useful context. However, it says nothing about whether the original code is modified in place, what permissions or limits apply, or how large an input is accepted — significant gaps for a transformation tool with zero annotation coverage.

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 compact sentence with the action front-loaded and no filler. It is efficient, though the trailing list of dimensions is somewhat redundant with the goal enum in the schema.

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

Completeness3/5

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

For a three-required-parameter tool with full schema coverage and no output schema, the description covers what it does and roughly what it returns. It still leaves the agent guessing about output format (diff vs full file), input size limits, and side effects, which matters for a code-mutating operation with no annotations.

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%, so the schema already documents all three parameters and their enums. The description only echoes three of the four goal values (performance, readability, security) and omits maintainability, adding essentially no meaning beyond the schema. Baseline 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 states a specific verb pair and resource: 'optimize and refactor existing code'. It also names the deliverables (specific suggestions plus optimized code), which separates it from a pure review or explain tool. It does not name any sibling explicitly, so it stops short of a 5.

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?

Scope is implied by 'existing code' and by the enumeration of improvement dimensions, which suggests this is for transforming already-written code rather than generating it. There is no explicit statement of when to prefer this over code_review, code_analyze, or code_debug, and no exclusions or prerequisites.

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