Skip to main content
Glama
syrian963

django-chainsaw-mcp

by syrian963

fastapi_exposure

Read-onlyIdempotent

Scans FastAPI endpoints to detect missing response_model declarations, preventing unintended exposure of ORM object fields.

Instructions

FastAPI endpoints that serialise more than they declare.

    @app.get("/users/{pk}")
    async def get_user(pk: int):
        return session.get(User, pk)

No response_model and no return annotation, so FastAPI serialises whatever
it is handed - the whole ORM object, every column, including the ones
added to the model next month. The absence of one line is the entire bug,
so there is nothing in the file to read or review.

Every FastAPI guide says to set response_model and several say a CI rule
should enforce it. No linter ships one.

An endpoint returning a dict or a literal is not reported: the author
decided what goes in it. Unauthenticated is critical, behind a dependency
is high - it still leaks to everyone who can log in.

Nothing here imports the project, because a FastAPI app usually wants a
database URL and a secret before it will import at all, and none of that is
needed to read a decorator. Needs no Django.

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

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.3/5.0
Behavior5/5

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

The description adds substantial behavioral detail beyond the read-only/idempotent annotations: it does not import the project, requires no database URL or secret, needs no Django, and only scans decorators for missing response_model/return annotations. It also discloses the security consequence of the leak. This gives an agent a clear and accurate model of how the tool behaves.

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 longer than average but well modularized: example, detection rule, false-positive scope, severity model, runtime constraints, and args. The core idea is front-loaded, and each paragraph earns its place. It is slightly verbose and repeats the missing-annotation concept, so it is not maximally concise.

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 one optional parameter and an output schema, the description is complete: it explains what is detected, how detection works, known false positives, severity levels, runtime constraints, and the search_path argument. The output schema covers return values, so their omission is acceptable. The 'Needs no Django' note also helps distinguish it from Django-specific sibling tools.

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?

The schema provides only the parameter title 'Search Path' and a null default, so description coverage is 0%. The description compensates with 'search_path: directory to scan. Defaults to the configured project,' which defines both the parameter's meaning and its default behavior. It does not explain what 'configured project' resolves to, which keeps it from a 5.

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 opening sentence names the resource and bug clearly: FastAPI endpoints that serialise more than they declare. The example and the explanation about missing response_model/return annotations make the tool's purpose concrete. It stops short of 5 because it uses a descriptive noun phrase rather than an explicit verb like 'detect', and it does not explicitly name a sibling tool for contrast.

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 description gives practical usage context: it positions the tool as the CI rule that no linter ships, and it provides severity guidance ('Unauthenticated is critical, behind a dependency is high'). It also states an explicit exclusion: endpoints returning a dict or literal are not reported. It does not explicitly say when to prefer a sibling tool, though 'Needs no Django' hints at the Django-oriented alternatives.

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