Skip to main content
Glama

Find slow pandas code

check_code
Read-onlyIdempotent

Scans Python source without running it to find slow pandas patterns such as iterrows loops, row-wise apply, and concat in loops, flagging code worth rewriting.

Instructions

Scan Python source for slow pandas patterns (iterrows loops, row-wise apply, concat in a loop, cell-by-cell writes, groupby-apply aggregates) without running it.

Use this first, to find what is worth rewriting. Each finding has a rule code (see list_rules), a line, a severity, a message and often a suggested rewrite. Suggestions are not verified: before telling the user a rewrite is equivalent or faster, call verify_rewrite on representative inputs. Read-only: the code is parsed, never executed.

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 to scan: a script, module or notebook cell.
filenameNoName shown in findings; use the real path if there is one.snippet.py

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / code / description
      Added value: +"Python source to scan: a script, module or notebook cell."
    • addedInput schema / properties / filename / description
      Added value: +"Name shown in findings; use the real path if there is one."
  2. First observedv0.1.1

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation it discloses the analysis mechanism ('the code is parsed, never executed'), the finding payload (rule code, line, severity, message, suggested rewrite) and a critical caveat that suggestions are unverified. The 'often a suggested rewrite' hedge and the warning against asserting equivalence tell the agent how much to trust output, which annotations do not convey.

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?

Front-loads the core action in one sentence, then two short paragraphs for workflow and trust caveats, with no filler. Every clause (rule codes, unverified suggestions, no execution) carries decision-relevant information.

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?

For a static-analysis tool with full schema coverage and an output schema, the description supplies what structured fields cannot: ordering relative to siblings, how much to trust suggestions, and a safety guarantee in plain language. Nothing needed to invoke or interpret it correctly is missing.

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 both parameters are already documented, including the notebook-cell/script nuance for `code` and the display purpose of `filename`. The description adds no format or constraint detail beyond the schema, so the baseline 3 applies.

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 and resource ('scan Python source for slow pandas patterns') and enumerates the concrete patterns it detects (iterrows, row-wise apply, concat in loop, cell-by-cell writes, groupby-apply). It is clearly distinct from list_rules (which supplies rule codes) and verify_rewrite (which validates suggestions), so an agent can select it without opening the schema.

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?

Gives explicit sequencing ('Use this first, to find what is worth rewriting') and a concrete when-to-use-next rule: call verify_rewrite on representative inputs before telling the user a rewrite is equivalent or faster. It also routes to list_rules for rule codes, covering the alternatives by name.

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