Skip to main content
Glama

format_code

Format Python code using Pyright's formatter to ensure consistent style and improve readability. Input Python code as a string for automatic formatting.

Instructions

Format Python code.

Formats the given Python code using pyright's formatter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython code as string.
python_pathNoOptional path to Python interpreter.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the formatter (pyright) but doesn't disclose behavioral traits like whether it modifies code in-place, returns formatted output, handles errors, or has rate limits. The description lacks details on what the tool actually does beyond the basic action, leaving gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence 'Format Python code.' directly states the purpose, and the second adds context without waste. Every sentence earns its place by providing essential information efficiently.

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?

Given the tool's moderate complexity (formatting code), 100% schema coverage, and the presence of an output schema (which means return values are documented elsewhere), the description is reasonably complete. It covers the what and how (using pyright) but lacks behavioral details. For a formatting tool with good schema support, this is adequate though not exhaustive.

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 both parameters ('code' and 'python_path') with descriptions. The description adds no additional meaning beyond what the schema provides, such as explaining parameter interactions or usage examples. Baseline 3 is appropriate as the schema handles the heavy lifting.

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's purpose: 'Format Python code' specifies the verb (format) and resource (Python code). It distinguishes from siblings like 'check_types' or 'get_completions' by focusing on formatting rather than analysis or suggestions. However, it doesn't explicitly contrast with potential formatting alternatives beyond mentioning pyright.

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?

The description implies usage context by stating 'Formats the given Python code using pyright's formatter,' suggesting this is for code formatting specifically with pyright. However, it doesn't provide explicit guidance on when to use this tool versus alternatives (e.g., other formatters or manual formatting), nor does it mention prerequisites or 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/daedalus/mcp-pyright'

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