Skip to main content
Glama
syrian963

django-chainsaw-mcp

by syrian963

scan_templates

Read-onlyIdempotent

Scan all Django templates for N+1 query risks, resolving template contexts automatically from class-based views to analyze entire projects without manual setup.

Instructions

Run the N+1 analysis over every template in a directory.

find_n_plus_one needs a context map per template. This resolves it instead
from class-based views that declare template_name together with model or
queryset, so a whole project can be scanned without typing anything.

Args:
    template_root: template directory. Defaults to the project path.
    project_root: where to look for views. Defaults to the project path.
    root_models: context applied to every template, for names no view supplies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
root_modelsNo
project_rootNo
template_rootNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.3

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already establish readOnly, idempotent, and non-destructive behavior. The description adds genuinely useful behavioral detail: it resolves context from class-based views declaring template_name with model/queryset, uses root_models as a fallback, and defaults both roots to the project path. This is enough context beyond what annotations provide.

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 tight and front-loaded: the action appears in the first sentence, the key differentiator follows immediately, and the args list is compact with no filler. Every sentence adds necessary information for selecting or invoking the tool.

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?

With three optional parameters, clear defaults, an output schema, and annotations covering safety, the description provides everything an agent needs to invoke this tool correctly. It even explains the integration path from views to templates, making the batch behavior understandable.

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 description coverage is 0%, so the description carries the full burden for parameter documentation. It explains all three parameters clearly: template_root, project_root, and root_models, including their defaults and the purpose of root_models as a fallback context source.

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: 'Run the N+1 analysis over every template in a directory.' It openly distinguishes itself from find_n_plus_one by explaining that this tool resolves the context map automatically, so an agent can tell them apart immediately.

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 makes the usage context clear by contrasting with find_n_plus_one: that tool needs a context map per template, while this one derives it from class-based views to scan a whole project without manual input. It does not explicitly list exclusions or when to prefer the alternative, but the intended batch-use case is strongly implied.

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