Skip to main content
Glama

format_code

Format Python code with ruff, or use check_only to report formatting issues without changing files.

Instructions

Format Python code with ruff; check_only=True only reports.

Input Schema

NameRequiredDescriptionDefault
cwdNo
pathNo.
check_onlyNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, destructiveHint=false, and openWorldHint=false. The description adds the one behavior annotations cannot express: that with check_only=True nothing is written, which matters given the schema default is true. It does not state that files are modified in place, whether non-Python files are skipped, or what errors look like, so it adds only modest context.

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?

One compact sentence with the primary action front-loaded and the mode caveat second. Nothing is wasted, though it is arguably too sparse for a mutating tool rather than over-long.

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?

An output schema exists, so return values need not be described. Still, the description omits that this rewrites files on disk by default-set check_only=False and says nothing about the path/cwd scope, which are material for a tool that can mutate a whole directory.

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%, so the description must carry parameter meaning and it only covers one of three parameters (check_only). 'cwd' and 'path' are left entirely to their bare titles and defaults, with no indication that path defaults to the current directory or how the two interact.

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?

Specific verb+resource: 'Format Python code with ruff' names the action, the target language, and the underlying engine. It is distinguishable from the sibling 'lint' tool by the formatter-versus-analyzer distinction, though that contrast is never made explicit.

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 clause 'check_only=True only reports' gives indirect guidance about which mode to pick, which is the main usage decision for this tool. However, there is no explicit statement of when to choose format_code over lint, or when formatting is appropriate versus unsafe.

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