| 1 | package Catalyst::Plugin::MCP::Role::ToolProvider; | ||
| 2 | 6 | ▶ | use v5.36; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 6 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 6 | our $VERSION = '0.003'; | |
| 6 | |||
| 7 | 6 | requires qw/list call/; | |
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Catalyst::Plugin::MCP::Role::ToolProvider - MCP tool provider contract | ||
| 12 | |||
| 13 | =head1 REQUIRED METHODS | ||
| 14 | |||
| 15 | =head2 list( $cursor ) | ||
| 16 | |||
| 17 | Return C<< { tools => \@items } >>. Each tool is a hashref with at least a | ||
| 18 | C<name>. Tools are NOT paginated: C<list> must return the complete tool set | ||
| 19 | (the engine validates a C<tools/call> name against it). Keep C<list> cheap: it | ||
| 20 | is also called once per C<tools/call> to validate the name, so cache it or make | ||
| 21 | it a trivial lookup if the underlying source is expensive. | ||
| 22 | |||
| 23 | =head2 call( $name, $args ) | ||
| 24 | |||
| 25 | Return a tool result hashref. For an execution failure return a normal result | ||
| 26 | carrying C<< isError => 1 >> with C<content>, NOT an exception. (Unknown-tool | ||
| 27 | and bad-argument cases are protocol errors raised by the engine, not here.) | ||
| 28 | |||
| 29 | =cut | ||
| 30 | |||
| 31 | 6 | 1; | |