MCP PHP SDK

SamplingRequestHandler implements RequestHandlerInterface

Handler for sampling requests from the server.

The MCP server may request the client to sample an LLM during tool execution. This handler wraps a user-provided callback that performs the actual LLM call.

Tags
author

Kyrian Obikwelu koshnawaza@gmail.com

Table of Contents

Interfaces

RequestHandlerInterface
Interface for handling requests from the server.

Properties

$callback  : SamplingCallbackInterface
$logger  : LoggerInterface

Methods

__construct()  : mixed
handle()  : Response<string|int, CreateSamplingMessageResult>|Error
Handle the request and return a response or error.
supports()  : bool
Check if this handler supports the given request.

Properties

Methods


        
On this page

Search results