module WarpEngine::AdminApi::Definitions::Meta
The meta resource: GET /me (MCP tool admin_whoami), open to any admin caller.
Constants
- X
-
Short name of
Definitions::Schemas.
Public Instance Methods
Source
# File lib/warp_engine/admin_api/definitions/meta.rb, line 12 def define(api) api.resource(:meta, label: "Meta", scope: :any, always: true) do |r| r.get "/me", name: :whoami, tool_name: "admin_whoami", summary: "Who is calling, with which scopes, and what they may use here", item: X.principal do |ctx| ctx.ok(principal_payload(ctx.principal)) end end end
Declares the meta resource on the Registry::Builder api.
# File lib/warp_engine/admin_api/definitions/meta.rb, line 23 def principal_payload(principal) config = AdminApi.config usable = Registry.resources.reject(&:always?).select do |resource| resource.operations.any? { |operation| Runner.permitted?(operation, principal) } end principal.as_json.merge( resources: usable.map { |resource| resource.name.to_s }, readOnly: config.read_only?, mcp: config.mcp? ) end
The GET /me answer for principal: Principal#as_json plus the resources it may use, whether the Admin API is read-only and whether MCP is on.