Skip to main content
Glama

api_check_code

Read-onlyIdempotent

Statically check Python or TypeScript code against installed library versions to catch hallucinated APIs, wrong arguments, or deprecated calls before running it.

Instructions

Check code for hallucinated or misused APIs of installed versions (check code, comprobar código, validar)

Statically checks a snippet against the libraries installed in the environment: unknown modules/attributes (hallucinated or removed APIs), unexpected keyword arguments, too many positional arguments, missing required arguments, deprecated calls. Never runs the code. Run it on code you wrote before showing it; fix errors, re-check.

Args: code: the source (a whole file or a snippet; imports must be included). env: environment id, project folder path, or omitted for the default environment. language: "python" (full checks) or "typescript" (v1: named imports only).

Returns: {ok, findings: [{line, col, severity, code, symbol, message, suggestion}], checked, unchecked, libraries}. ok is false only for errors. severity "warning" = not a declared member but the class/module creates names dynamically, or deprecated. Babel stays silent on anything it cannot prove (dynamic code, unknown types, try/except ImportError, hasattr guards); those count in 'unchecked'. Keywords: check code, validate code, hallucinated api, does this exist, wrong arguments, verify snippet, comprobar codigo, revisar codigo, validar, existe, alucinacion

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
envNo
codeYes
languageNopython

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description adds substantial non-obvious behavior: "Never runs the code," the silent-failure policy ("Babel stays silent on anything it cannot prove" — dynamic code, hasattr guards, try/except ImportError), and the fact that those go into 'unchecked' rather than findings. That is exactly the kind of context annotations cannot convey.

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 core description is front-loaded and information-dense, with the key constraint (never runs code) early. The trailing keyword block is bulky and partially redundant with the opening line, which costs a point, though it aids retrieval.

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?

There is no output schema, but the description reproduces the full return shape ({ok, findings:[{line, col, severity, code, symbol, message, suggestion}], checked, unchecked, libraries}) and defines the semantics of 'ok' and 'warning' severity. An agent has everything needed to call and interpret this tool.

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

Parameters5/5

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

Schema coverage is 0%, so the description must carry the load, and it does: 'code' requires imports to be included, 'env' accepts an environment id, a project folder path, or omission for the default, and 'language' enumerates "python" (full checks) vs "typescript" (v1: named imports only). Each parameter's accepted values and limitations are explained.

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?

States a specific verb (check) plus the precise resource (code against installed library APIs) and enumerates the failure classes it detects: unknown modules/attributes, unexpected kwargs, arg-count errors, deprecated calls. This clearly separates it from the docs_* and api_lookup siblings, which retrieve information rather than validate a snippet.

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?

Gives explicit temporal guidance: "Run it on code you wrote before showing it; fix errors, re-check." That is a clear when-to-use rule. It does not name a sibling alternative or state when-not to use it, so it falls 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.