1package client
2
3import (
4 "context"
5
6 "github.com/mark3labs/mcp-go/mcp"
7)
8
9// SamplingHandler defines the interface for handling sampling requests from servers.
10// Clients can implement this interface to provide LLM sampling capabilities to servers.
11type SamplingHandler interface {
12 // CreateMessage handles a sampling request from the server and returns the generated message.
13 // The implementation should:
14 // 1. Validate the request parameters
15 // 2. Optionally prompt the user for approval (human-in-the-loop)
16 // 3. Select an appropriate model based on preferences
17 // 4. Generate the response using the selected model
18 // 5. Return the result with model information and stop reason
19 CreateMessage(ctx context.Context, request mcp.CreateMessageRequest) (*mcp.CreateMessageResult, error)
20}