NAME

MCP::Primitive - Primitive base class

SYNOPSIS

package MyMCPPrimitive;
use Mojo::Base 'MCP::Primitive';

1;

DESCRIPTION

MCP::Primitive is a base class for MCP (Model Context Protocol) primitives such as MCP::Tool, MCP::Prompt, and MCP::Resource.

METHODS

MCP::Primitive inherits all methods from Mojo::Base and implements the following new ones.

context

my $context = $primitive->context;

Returns the MCP::Server::Context for the current request. Capture this before an async boundary to keep using its notification methods from later callbacks.

# Get controller for requests using the HTTP transport
my $c = $primitive->context->controller;

SEE ALSO

MCP, https://mojolicious.org, https://modelcontextprotocol.io.