php-sdk/tests/Unit
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Johannes Wachter e4a8a224ff
[Client] Add client-side elicitation support (#371)
* [Client] Add client-side elicitation support

The SDK could send elicitation/create requests from a server tool via
ClientGateway::elicit(), but the client could not receive them: there was
no request handler, and ElicitRequest was not registered in MessageFactory,
so incoming elicitation/create messages failed to parse.

This adds the client half, mirroring the existing Sampling pattern:

- Register ElicitRequest in MessageFactory so elicitation/create parses.
- ElicitationRequestHandler wraps a user callback and returns an
  ElicitResult (accept/decline/cancel) or an Error.
- ElicitationCallbackInterface defines the callback contract.
- ElicitationException forwards a specific message to the server; any
  other throwable returns a generic error.

Includes unit tests, a runnable client example against the elicitation
demo server, and client docs/README updates.

* [Client] Simplify elicitation example labelFor() per review

Type the parameter as AbstractSchemaDefinition and read ->title directly
instead of matching on each concrete definition type. title is a required
non-null string on the base class, so the match and the $name fallback were
redundant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-14 23:55:06 +02:00
..
Capability [Server] Allow pre-built instance handlers in element registration (#375) 2026-07-06 01:13:41 +02:00
Client/Handler/Request [Client] Add client-side elicitation support (#371) 2026-07-14 23:55:06 +02:00
Fixtures/Enum Split testsuite for unit and inspector based tests (#82) 2025-09-25 22:27:41 +01:00
JsonRpc [Client] Add client-side elicitation support (#371) 2026-07-14 23:55:06 +02:00
Schema [Schema] Fix Implementation::fromArray rejecting falsy-but-valid name/version (#393) 2026-07-14 23:41:51 +02:00
Server [Server] Allow pre-built instance handlers in element registration (#375) 2026-07-06 01:13:41 +02:00
ServerTest.php Update codestyle based on updated Symfony rules (#229) 2026-02-01 11:54:31 +01:00