[Schema][Server] Harden sampling tools against the spec (#420)
* harden sampling tools against the spec Report tool-flow violations as -32602 instead of dropping the request, accept resource_link in tool results, gate tools on sampling.tools, and reject empty content. * normalize keyed content arrays to lists array_filter() and friends preserve keys, and a keyed array serializes as a JSON object instead of the content-block array the schema requires.
This commit is contained in:
parent
becce29c41
commit
43815e38a8
1 changed files with 1212 additions and 167 deletions
|
|
@ -21,7 +21,12 @@ class ClientCapabilities implements \JsonSerializable
|
|||
{
|
||||
/**
|
||||
* @param array<string, mixed> $experimental
|
||||
* @param ?array<string, mixed> $extensions protocol extensions the client supports (e.g. io.modelcontextprotocol/ui)
|
||||
* @param ?array<string, mixed> $extensions protocol extensions the client supports (e.g. io.modelcontextprotocol/ui)
|
||||
* @param ?bool $samplingContext the `sampling.context` sub-capability
|
||||
* @param ?bool $samplingTools the `sampling.tools` sub-capability
|
||||
*
|
||||
* The two sampling sub-capabilities trail `extensions` rather than sitting next to
|
||||
* `sampling` so that existing positional calls keep working. Pass them by name.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly ?bool $roots = false,
|
||||
|
|
|
|||
Loading…
Reference in a new issue