Class: McpToolkit::Authority::Tools::List
- Inherits:
-
Base
- Object
- Base
- McpToolkit::Authority::Tools::List
- Defined in:
- lib/mcp_toolkit/authority/tools/list.rb
Overview
Authority-path tool: fetch a paginated list of records from a registered resource, scoped to the caller's resolved account. Gates a superuser-only resource, the resource's required scope, and requires a selected account before reading. Standard filters, per-attribute equality/operator filters, resource custom filters, pagination, and sparse fieldsets are all handled by the reused McpToolkit::ListExecutor.
Constant Summary collapse
- BARE_VALUE_GRAMMAR =
The bare-value grammar bullet, per config.bare_filter_value_semantics: the served description must state the semantics the host ACTUALLY configured — advertising comma/"null" tokenization to clients of a :literal host would send them filters that silently match nothing. The :tokenized text is the exact bullet embedded in the static description below (spec-pinned), so .description_text can swap it by plain substring substitution; both use
<<-(no dedent) to carry the description's rendered 2-space indentation. { tokenized: <<-TEXT.rstrip, literal: <<-TEXT.rstrip - A bare value matches by equality, LITERALLY: a comma-separated string is a single value and the string "null" is the literal string. A JSON null matches records where the value is NULL. An array of scalars matches ANY of its values (IN). TEXT }.freeze
Class Method Summary collapse
-
.description_text(config) ⇒ Object
Swaps the bare-value bullet for the host's configured semantics; the rest of the description is mode-independent.
Instance Method Summary collapse
Class Method Details
.description_text(config) ⇒ Object
Swaps the bare-value bullet for the host's configured semantics; the rest of the description is mode-independent.
33 34 35 36 37 |
# File 'lib/mcp_toolkit/authority/tools/list.rb', line 33 def self.description_text(config) return _description unless config && config. == :literal _description.sub(BARE_VALUE_GRAMMAR[:tokenized], BARE_VALUE_GRAMMAR[:literal]) end |
Instance Method Details
#call(context:, resource: nil, **params) ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/mcp_toolkit/authority/tools/list.rb', line 122 def call(context:, resource: nil, **params) descriptor = resolve_descriptor(resource) ensure_resource_accessible!(descriptor, context) ensure_scope!(descriptor, context) ensure_account!(context) run_executor do McpToolkit::ListExecutor.call(resource: descriptor, scope_root: context.account, params:) end end |