Skip to main content
Glama

Validate Python

validate_python
Read-onlyIdempotent

Check Python source without running it: parse, lint (ruff), type-check (mypy), AST security policy, credential scan. Safe on code you do not trust. Use it on every Python file you generated or edited, before writing it to disk. Alternatives: repair_python to get the corrected source instead of the diagnosis; execute_python to prove the code runs. Auth: a key is required. A free key covers this call, 25 per day, then HTTP 429; get one with POST /v1/keys. Credits are bought without an account, 1 per call: GET /v1/pricing says where to send the xDAI. Or pay for this one call with no key at all: call it without one and the result carries x402 payment requirements ($0.01 in USD Coin on eip155:8453); sign them and repeat the call with the payment in _meta['x402/payment']. Arguments: code: the whole file, 1..200000 bytes of UTF-8 measured after encoding (empty is refused with 400, larger with 413); a fragment is fine, but line and column numbers in the answer count from 1 in what you sent. language: must be 'python'; anything else is 400, and the field may be omitted. Of options only transpile_to (e.g. 'javascript', which returns a translated copy in transpiled) acts here; timeout_s, max_iterations, optimize, examples and expected_output need a pass that rewrites or runs the code, so send code alone. Ignored options are not refused, so a call that sets them looks like it worked; and code that does not parse is answered rather than refused: valid=false with the syntax error located, which is the point. Returns valid, score 0..1, diagnostics (rule, message, line, column), security findings, fixes, fixed_code and runtime; see outputSchema. The code and its verdict are retained to improve the service.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe source to check, as a whole file where possible: diagnostics carry the line and column of the text you send, and a fragment hides the imports and definitions the type check needs. A deployment may accept fewer bytes than the 200000 here.
optionsNoTuning knobs. Most of them only take effect in the mode that does the corresponding work; see each field.
languageNoThe language of the code. A service that does not handle it refuses the request rather than guessing; the enum is shared across services, so it lists more than any one of them accepts.python

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
metaYes
fixesNo
scoreYes
validYes
runtimeNo
securityNo
fixed_codeNo
transpiledNo
diagnosticsNo

TDQS

A4.8/5.0
Behavior5/5

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

Annotations declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, which the description reinforces without contradiction. It adds substantial behavioral context beyond the annotations: notes the tool is safe on untrusted code, warns that ignored options are not refused, states that unparsable code is answered rather than refused, and discloses data retention ('code and its verdict are retained'). These details materially affect tool use and are not visible from annotations alone.

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?

The description is long but front-loaded: the first sentence states the core purpose, followed by usage guidance, auth details, argument semantics, and return pointer. Each section earns its place, though the auth and payment explanation is verbose and could be condensed without losing critical information. Overall, the structure is clear and appropriately detailed for the tool's complexity.

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

Completeness5/5

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

The description covers all critical contextual aspects: what checks are performed, safety profile, usage timing, alternatives, authentication and payment requirements, rate limits, parameter limitations, error behavior, data retention, and a pointer to the output schema. Since an output schema exists, the description need not enumerate return fields in detail, but it references it. This is complete for a complex validation tool.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description adds meaning beyond the schema by clarifying that only transpile_to among the options takes effect in static mode, while others (timeout_s, max_iterations, optimize, examples, expected_output) require a pass that rewrites or runs code. It also explains that line/column numbers count from 1 in the submitted fragment, which enriches the code parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Check Python source without running it: parse, lint (ruff), type-check (mypy), AST security policy, credential scan.' It clearly distinguishes from siblings by listing alternatives: repair_python for corrected source, execute_python to prove code runs. This makes the tool's purpose unmistakable and differentiates it from related tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit when-to-use guidance: 'Use it on every Python file you generated or edited, before writing it to disk.' It also names alternatives with their distinct purposes ('repair_python to get the corrected source instead of the diagnosis; execute_python to prove the code runs') and explains which options are ineffective in this mode, preventing misuse.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.9/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: validate only diagnoses, repair diagnoses and fixes, execute diagnoses, fixes, and runs. The descriptions explicitly state the differences and alternatives, leaving no ambiguity about which to choose.

Naming Consistency5/5

All tools follow the same verb_noun pattern: validate_python, repair_python, execute_python. The naming is perfectly consistent and predictable.

Tool Count5/5

Three tools is a well-scoped set for a Python code validator. Each tool adds a distinct level of functionality (diagnose, fix, run), and there are no redundant or unnecessary tools.

Completeness5/5

The toolset covers the full lifecycle of Python code validation: diagnose (validate), fix (repair), and verify (execute). The options within the tools (e.g., transpile, optimize, examples) further round out the surface, leaving no critical gaps.