Skip to main content
Glama
syrian963

django-chainsaw-mcp

by syrian963

money_precision

Read-onlyIdempotent

Detect money precision risks in Django projects by scanning for unsafe Decimal(float()) calls, banker's rounding, and float conversions that make currency inexact.

Instructions

Places where a decimal amount stops being exact.

A DecimalField exists so that money is exact. Four things give that up,
and they are not equally bad:

    Decimal(0.1)            wrong from birth - 0.1 has no exact binary
                            form, so this is 0.1000000000000000055...
    float(invoice.amount)   a one-way door; everything after is approximate
    round(amount, 2)        exact, but banker's rounding: 0.125 becomes
                            0.12 where an invoice expects 0.13
    FloatField("price")     the column itself cannot hold money

Decimal(0.5) is NOT reported as a defect: that float is exactly
representable and nothing is lost. The check computes the round trip, so
on a real project 41 of 50 Decimal(<float>) calls came back harmless and
11 were genuinely wrong. Nothing in the linter ecosystem looks at this;
the usual advice stops at the model definition and every one of these
happens somewhere else.

Args:
    search_path: directory to scan. Defaults to the project root.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_pathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.3

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the readOnly/idempotent/non-destructive annotations, the description explains exact detection semantics: four defect categories, the explicit exclusion of Decimal(0.5), the round-trip verification approach, and real-world false-positive rates. This gives the agent a precise model of what the tool will flag and what it will ignore.

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?

The description is front-loaded with the core idea, uses a scannable bullet list for the four failure modes, and every paragraph adds either detection detail, a false-positive rule, or project context. The length is justified by the nuanced subject matter.

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 single-parameter read-only audit tool with an output schema, the description covers what is checked, what is deliberately not reported, how the check behaves, and how to point it at a directory. Nothing essential is missing.

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?

With 0% schema description coverage, the description must carry parameter meaning, and it does: search_path is defined as the directory to scan with a default of the project root. It doesn't spell out path format or edge cases, but for a single optional parameter this is adequate.

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?

The description opens with a crisp thesis—'Places where a decimal amount stops being exact'—and then enumerates the four concrete code patterns that trigger the check, making the tool's function evident. It doesn't use an explicit verb like 'scan' or 'report', but the domain and behavior are unmistakable from the examples and 'reported as a defect'.

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?

The text gives clear context about when the tool adds value: it covers precision loss that happens outside the model definition, where 'the usual advice stops' and where 'nothing in the linter ecosystem looks'. It does not name sibling tools or state explicit when-not-to-use conditions, but the context is strong enough for an agent to know this is the money-precision audit.

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