Skip to main content
Glama

rails_get_callbacks

Read-onlyIdempotent

Retrieves ActiveRecord model callbacks grouped by type in Rails event order to reveal side effects, debug callback chains, and check save/create/destroy behavior; optional source code.

Instructions

Get ActiveRecord model callbacks grouped by type, in Rails event order: before/after/around for validation, save, create, update, destroy. Use when: understanding side effects, debugging callback chains, or checking what happens on save/create/destroy. Specify model:"User" for one model's callbacks. detail:"full" includes callback method source code. The list is what the model, its base classes and its concerns declare, and within one type the order is the order Rails runs them, a before_ or around_ callback with prepend: true first, and after_commit in the order the app's setting gives.

Input Schema

NameRequiredDescriptionDefault
modelNoModel class name (e.g. 'User', 'Post'). Omit to see all models with their callbacks.
detailNoDetail level. summary: model names + callback counts. standard: callbacks by type in Rails event order (default). full: callbacks with method source code.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv5.39.1

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotentHint/non-destructive, so safety is covered; the description adds genuine behavioral context beyond that — the callback list reflects what the model, base classes and concerns declare, and ordering rules (prepend: true first, after_commit per app setting) are disclosed. It does not mention response size or truncation for large models, but the ordering semantics are the more important omission to have covered.

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?

Purpose and 'use when' are front-loaded, which is the right order. The final sentence is a long run-on that packs inheritance scope and three ordering rules into one clause chain; it earns its content but could be split for readability.

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 two-parameter read-only inspection tool with no output schema, the description covers scope (single model vs all), detail levels, inheritance/concern inclusion, and execution ordering — enough for an agent to call it correctly and interpret results without further clarification.

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 both parameters are already fully documented including the detail enum levels. The description restates the same facts (model:'User' for one model, detail:'full' for source code) with no additional syntax, defaults, or edge-case guidance, so the baseline 3 applies.

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: 'Get ActiveRecord model callbacks grouped by type, in Rails event order', with the enumerated event types (validation, save, create, update, destroy). This clearly separates it from siblings like rails_get_model_details or rails_get_concern, which address the model or concern broadly rather than callback chains.

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: understanding side effects, debugging callback chains, or checking what happens on save/create/destroy' gives concrete triggering scenarios rather than leaving usage implied. It stops short of naming a sibling alternative or stating when not to use it, so it sits just below the top tier.

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