annotation ActionController::MCP
#
configures how a route, or every route in a controller, is exposed by the
optional MCP server (see ActionController::MCPServer)
hide: trueexcludes the route(s) from the MCP toolboxesroot: truealways lists the tool(s) or prompt(s), without opening the toolboxprompt: trueexposes a method as an MCP prompt (not as a HTTP route). The method must returnStringorArray(AC::PromptMessage)
a method level annotation overrides the controller level annotation
@[AC::MCP(hide: true)]
class Internal < AC::Base
# exposed even though the rest of the controller is hidden
@[AC::MCP(hide: false)]
@[AC::Route::GET("/status")]
def status : String
"ok"
end
end
class Widgets < AC::Base
# summarise a widget for the user
@[AC::MCP(prompt: true)]
def summarise(
@[AC::Param::Info(description: "the widget to summarise")]
id : Int64,
) : String
"Summarise the widget: #{Widget.find(id).to_json}"
end
end