1313
1414use Mcp \Exception \InvalidArgumentException ;
1515use Mcp \Schema \Content \SamplingMessage ;
16+ use Mcp \Schema \Enum \SamplingContext ;
1617use Mcp \Schema \JsonRpc \Request ;
1718use Mcp \Schema \ModelPreferences ;
1819
@@ -29,25 +30,24 @@ final class CreateSamplingMessageRequest extends Request
2930 * @param SamplingMessage[] $messages the messages to send to the model
3031 * @param int $maxTokens The maximum number of tokens to sample, as requested by the server.
3132 * The client MAY choose to sample fewer tokens than requested.
32- * @param ModelPreferences|null $preferences The server's preferences for which model to select. The client MAY
33+ * @param ? ModelPreferences $preferences The server's preferences for which model to select. The client MAY
3334 * ignore these preferences.
34- * @param string|null $systemPrompt An optional system prompt the server wants to use for sampling. The
35+ * @param ? string $systemPrompt An optional system prompt the server wants to use for sampling. The
3536 * client MAY modify or omit this prompt.
36- * @param string|null $includeContext A request to include context from one or more MCP servers (including
37+ * @param ?SamplingContext $includeContext A request to include context from one or more MCP servers (including
3738 * the caller), to be attached to the prompt. The client MAY ignore this request.
38- *
39- * Allowed values: "none", "thisServer", "allServers"
40- * @param float|null $temperature The temperature to use for sampling. The client MAY ignore this request.
41- * @param string[]|null $stopSequences A list of sequences to stop sampling at. The client MAY ignore this request.
42- * @param ?array<string, mixed> $metadata Optional metadata to pass through to the LLM provider. The format of
43- * this metadata is provider-specific.
39+ * Allowed values: "none", "thisServer", "allServers"
40+ * @param ?float $temperature The temperature to use for sampling. The client MAY ignore this request.
41+ * @param ?string[] $stopSequences A list of sequences to stop sampling at. The client MAY ignore this request.
42+ * @param ?array<string, mixed> $metadata Optional metadata to pass through to the LLM provider. The format of
43+ * this metadata is provider-specific.
4444 */
4545 public function __construct (
4646 public readonly array $ messages ,
4747 public readonly int $ maxTokens ,
4848 public readonly ?ModelPreferences $ preferences = null ,
4949 public readonly ?string $ systemPrompt = null ,
50- public readonly ?string $ includeContext = null ,
50+ public readonly ?SamplingContext $ includeContext = null ,
5151 public readonly ?float $ temperature = null ,
5252 public readonly ?array $ stopSequences = null ,
5353 public readonly ?array $ metadata = null ,
@@ -114,7 +114,7 @@ protected function getParams(): array
114114 }
115115
116116 if (null !== $ this ->includeContext ) {
117- $ params ['includeContext ' ] = $ this ->includeContext ;
117+ $ params ['includeContext ' ] = $ this ->includeContext -> value ;
118118 }
119119
120120 if (null !== $ this ->temperature ) {
0 commit comments