Skip to main content
Glama

scan_project_queries

Statically scans a project for SQL and ORM/query patterns, detects N+1 loops, masks PII literals, and produces a consolidated per-table index plan to guide database performance tuning.

Instructions

Statically scan a codebase directory to extract raw SQL and ORM/Query Builder patterns (Go, PHP/Laravel, TS/Prisma, Python), detect N+1 query loops, mask PII literals, and synthesize a holistic consolidated index plan per table.

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": {
      "project_root_path": "<project_root_path>",
      "dialect": "<dialect>"
    },
    "name": "scan_project_queries"
  }
}

Input Schema

NameRequiredDescriptionDefault
dialectYes
focus_tablesNo
exclude_globsNo
target_languagesNo
max_files_to_scanNo
project_root_pathYes
existing_schema_ddlNo
migration_files_dirNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.1/5.0
Behavior3/5

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

With no annotations, the description must carry the behavioral burden; 'statically scan' implies a read-only, non-mutating operation and the PII-masking step flags that returned literals are sanitized, which is useful. However it says nothing about whether files are written, runtime cost at the 5000-file default, permission requirements, or result shape — material gaps for an 8-parameter scanning tool.

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?

A single front-loaded sentence that leads with the action and then lists capabilities, with no filler. It is slightly run-on, packing four distinct behaviors into one clause chain, but every clause conveys real function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 8 parameters, zero schema coverage, no annotations, and no output schema, the description leaves most of the calling contract unspecified — what the index plan looks like, how focus_tables and existing_schema_ddl alter results, and whether the scan is purely read-only are all unstated.

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

Parameters2/5

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

Schema coverage is 0% across 8 parameters, yet the description explains none of them: dialect, focus_tables, exclude_globs, max_files_to_scan, existing_schema_ddl, and migration_files_dir are all undocumented in both places. The language list partially maps to target_languages but even omits 'javascript' and 'sql' from the enum.

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?

Names a specific verb ('statically scan') and resource ('codebase directory'), then enumerates the concrete outputs: SQL/ORM extraction, N+1 detection, PII masking, and a per-table index plan. That scope naturally separates it from siblings like recommend_indexes_for_queries or analyze_migration, but the description never states that contrast explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: an agent can infer it should be used when it has a project root and wants to discover queries and index opportunities. There is no explicit when-to-use, when-not-to-use, or pointer to a sibling such as recommend_indexes_for_queries when queries are already known.

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