annotation ActionController::MCP

Overview

configures how a route, or every route in a controller, is exposed by the optional MCP server (see ActionController::MCPServer)

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

Defined in:

action-controller/router/builder.cr