Skip to main content
Glama

rails_performance_check

Read-onlyIdempotent

Detects Rails performance anti-patterns via static analysis—N+1 risks, missing counter caches, indexes, eager loading candidates, and Model.all calls—before deploy or while investigating slow pages.

Instructions

Static analysis for Rails performance anti-patterns: N+1 query risks, missing counter_cache, Model.all in controllers, missing foreign key indexes, eager loading candidates. Use when: reviewing code for performance, before deploying, or investigating slow pages. Key params: model (filter by model), category (filter by issue type), detail level.

Input Schema

NameRequiredDescriptionDefault
modelNoFilter results to a specific model (e.g., 'User', 'Post')
detailNoLevel of detail: summary (counts), standard (issues + suggestions), full (+ code context)
categoryNoFilter by issue category (default: all)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv5.39.1

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description adds that this is *static* analysis (no app execution), which is genuinely useful context, but says nothing about scope of scanning, cost, or how results are organized beyond the detail enum.

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 capability list is front-loaded and the usage triggers follow immediately, with no wasted preamble. The trailing 'Key params' sentence is largely redundant with the schema and slightly dilutes an otherwise tight description.

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

Completeness4/5

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

No output schema exists, but the detail enum describes output granularity (counts vs issues vs code context), and annotations cover safety and idempotency. Required parameters are zero and all three params are schema-documented, so an agent has what it needs to call it correctly.

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 description coverage is 100%, and the enums for detail and category are fully documented in the schema itself. The 'Key params' sentence merely restates what the schema already provides, adding no new meaning such as filtering interaction or defaults beyond 'default: all'.

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?

States a specific verb ('Static analysis') and resource ('Rails performance anti-patterns') and enumerates the concrete issue classes it detects (N+1, counter_cache, indexes, Model.all, eager loading). This clearly separates it from rails_security_scan or rails_diagnose, though it never names a sibling explicitly.

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?

'Use when: reviewing code for performance, before deploying, or investigating slow pages' gives concrete triggering contexts. It stops short of any when-not guidance or explicit routing to alternatives such as rails_diagnose for runtime problems.

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