Skip to main content
Glama

rails_generate_test

Read-onlyIdempotent

Generate copy-paste-ready Rails test files that match your project's existing framework, factories, and assertion style for models, controllers, services, or request/system tests.

Instructions

Generate test scaffolding that matches your project's actual test patterns - framework, factories, assertion style. Use when: adding tests for a model, controller, or service. Generates copy-paste-ready test files. Key params: model (e.g. 'User'), controller (e.g. 'PostsController'), file (e.g. 'app/services/foo.rb').

Input Schema

NameRequiredDescriptionDefault
fileNoFile path relative to Rails root (e.g. 'app/services/payment_service.rb'). Auto-detects type.
typeNoTest type: unit (model/service, default), request (controller), system (browser/Capybara).
modelNoModel name (e.g. 'User'). Generates model spec with validations, associations, scopes, enums.
controllerNoController name (e.g. 'PostsController'). Generates request spec with routes and auth.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv5.39.1

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotent/non-destructive; the description adds the meaningful detail that output is 'copy-paste-ready' text rather than files written to disk, resolving the main ambiguity about what 'generates' means. It still doesn't state whether anything is persisted or how large the output is, so not a 5.

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?

Benefit is front-loaded, then the use case, then params — good ordering and no wasted prose. The trailing param list is largely redundant given the fully described schema, which keeps it from a 5.

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?

With no output schema, the description carries the burden of explaining what comes back, and 'copy-paste-ready test files' plus framework/factory/assertion-style matching covers that adequately. It doesn't say how file paths or types interact (all params optional, no required args), which is a minor remaining gap.

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 coverage is 100%, so all four parameters plus the type enum are already documented with examples. The 'Key params' sentence repeats the schema's own examples ('User', 'PostsController') without adding selection logic, e.g. when to pass file versus model/controller. Baseline 3 applies.

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 and resource ('Generate test scaffolding') and characterizes the output ('copy-paste-ready test files' matching the project's framework, factories, and assertion style). It doesn't explicitly contrast itself with the most confusable sibling, rails_get_test_info, so differentiation is inferred rather than stated.

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: adding tests for a model, controller, or service' gives a clear triggering context. It stops short of exclusions or naming an alternative for read-only inspection (rails_get_test_info), so it is context without routing.

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