Skip to main content
Glama

check_code

Validate Python source or markdown for calls to nonexistent library APIs, including hallucinated functions, methods, modules, imports, and keyword arguments before presenting or running the code.

Instructions

Check Python code for calls to library APIs that don't exist (hallucinated functions, methods, modules, imports and standard library keyword arguments). Covers the Python standard library (checked against the running interpreter) and NumPy, pandas, Matplotlib, PyTorch, scikit-learn and SciPy (checked against their documentation inventories). Accepts plain Python or markdown with code blocks. Use it on code you wrote before presenting or running it.

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

Input Schema

NameRequiredDescriptionDefault
codeYesPython source or markdown with ```python blocks

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose important traits: coverage is scoped to the running interpreter's stdlib plus named documentation inventories for NumPy, pandas, Matplotlib, PyTorch, scikit-learn and SciPy, which tells the agent what will be missed. It does not state whether the code is executed or only statically parsed (a material safety question given 'checked against the running interpreter'), nor what the result looks like or how findings are reported.

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?

Four compact sentences ordered as what-it-does, coverage, accepted input, and when-to-use, with no filler. Nothing in the text is redundant with the title or padding.

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?

For a one-parameter check tool this covers purpose, scope, input format, and call timing well. The notable gap is the return value: with no output schema, the agent is not told whether it gets a boolean, a list of issues with line numbers, or a rewritten file, so it cannot plan follow-up steps confidently.

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 coverage is 100% and the single parameter is fully documented, so the baseline of 3 applies. The description's note about accepting 'plain Python or markdown with code blocks' largely restates the schema's own parameter description, adding little new meaning.

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?

States a specific verb and resource ('Check Python code for calls to library APIs that don't exist') and enumerates exactly what counts as a hit: functions, methods, modules, imports, and stdlib keyword arguments. An agent knows precisely what the tool detects, but the description never contrasts itself with the sibling lookup_api, so the routing signal is inferred rather than stated.

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

Usage Guidelines4/5

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

'Use it on code you wrote before presenting or running it' gives a concrete trigger point in the workflow, which is stronger than most. There is no when-not guidance and no explicit alternative (e.g., use lookup_api for a single ambiguous symbol), so it stops short of a 5.

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

Deploy Server

Other Tools