Class: RailsAiBridge::Serializers::Formatters::Providers::McpGuideFormatter

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_ai_bridge/serializers/formatters/providers/mcp_guide_formatter.rb

Overview

Generates the MCP Tool Reference section for compact serializers.

This long-form guide (tables, detail limits) is embedded from Providers::BaseProviderSerializer. It intentionally differs from Providers::McpToolReferenceFormatter, which serves rules-oriented serializers with a shorter summary. Unify content only when product or documentation explicitly requires both surfaces to match.

Instance Attribute Summary

Attributes inherited from Base

#context

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from RailsAiBridge::Serializers::Formatters::Base

Instance Method Details

#callString

Returns markdown block ready to embed in a compact context file.

Returns:

  • (String)

    markdown block ready to embed in a compact context file



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rails_ai_bridge/serializers/formatters/providers/mcp_guide_formatter.rb', line 14

def call
  <<~MARKDOWN.rstrip
    ## MCP Tool Reference

    This project exposes live MCP tools. **Always start with `detail:"summary"`**,
    then drill into specifics with a filter or `detail:"full"`.

    ### Detail levels (schema, routes, models, controllers)

    | Level | Returns | Default limit |
    |-------|---------|---------------|
    | `summary` | Names + counts | 50 |
    | `standard` | Names + key details | 15 (default) |
    | `full` | Everything (indexes, FKs, etc.) | 5 |

    ### rails_get_schema
    Params: `table`, `detail`, `limit`, `offset`, `format`
    - `rails_get_schema(detail:"summary")` — all tables with column counts
    - `rails_get_schema(table:"users")` — full detail for one table
    - `rails_get_schema(detail:"summary", limit:20, offset:40)` — paginate

    ### rails_get_model_details
    Params: `model`, `detail`
    - `rails_get_model_details(detail:"summary")` — list all model names
    - `rails_get_model_details(model:"User")` — associations, validations, scopes, enums, callbacks
    - `rails_get_model_details(detail:"full")` — all models with full association lists

    ### rails_get_routes
    Params: `controller`, `detail`, `limit`, `offset`
    - `rails_get_routes(detail:"summary")` — route counts per controller
    - `rails_get_routes(controller:"users")` — routes for one controller
    - `rails_get_routes(detail:"full", limit:50)` — full table with route names

    ### rails_get_controllers
    Params: `controller`, `detail`
    - `rails_get_controllers(detail:"summary")` — names + action counts
    - `rails_get_controllers(controller:"UsersController")` — actions, filters, strong params

    ### Other tools (no detail param)
    - `rails_get_config` — cache store, session, timezone, middleware, initializers
    - `rails_get_test_info` — test framework, factories/fixtures, CI config, coverage
    - `rails_get_gems` — notable gems categorized by function (auth, background jobs, etc.)
    - `rails_get_conventions` — architecture patterns, directory structure, config files
    - `rails_search_code(pattern:"regex", file_type:"rb", max_results:20)` — ripgrep search
  MARKDOWN
end