Skip to content

Commit 15a47e8

Browse files
fix(server): _createMessageVia drops unconditional base sampling cap check (v1 parity; was gated on enforceStrictCapabilities)
1 parent 6dfcc47 commit 15a47e8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/server/src/server/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,10 @@ export class Server extends Protocol<ServerContext> {
472472
params: CreateMessageRequest['params'],
473473
options?: RequestOptions
474474
): Promise<CreateMessageResult | CreateMessageResultWithTools> {
475-
if (!this._clientCapabilities?.sampling) {
476-
throw new SdkError(SdkErrorCode.CapabilityNotSupported, 'Client does not support sampling capability.');
477-
}
478-
if ((params.tools || params.toolChoice) && !this._clientCapabilities.sampling.tools) {
475+
// Base `sampling` capability is checked via assertCapabilityForMethod() (gated on
476+
// enforceStrictCapabilities, which defaults to false). Only the `sampling.tools`
477+
// sub-capability is enforced here unconditionally, matching the v1 createMessage body.
478+
if ((params.tools || params.toolChoice) && !this._clientCapabilities?.sampling?.tools) {
479479
throw new SdkError(SdkErrorCode.CapabilityNotSupported, 'Client does not support sampling tools capability.');
480480
}
481481

0 commit comments

Comments
 (0)