Skip to content

Commit 2358111

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

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
@@ -489,10 +489,10 @@ export class Server extends Protocol<ServerContext> {
489489
params: CreateMessageRequest['params'],
490490
options?: RequestOptions
491491
): Promise<CreateMessageResult | CreateMessageResultWithTools> {
492-
if (!this._clientCapabilities?.sampling) {
493-
throw new SdkError(SdkErrorCode.CapabilityNotSupported, 'Client does not support sampling capability.');
494-
}
495-
if ((params.tools || params.toolChoice) && !this._clientCapabilities.sampling.tools) {
492+
// Base `sampling` capability is checked via assertCapabilityForMethod() (gated on
493+
// enforceStrictCapabilities, which defaults to false). Only the `sampling.tools`
494+
// sub-capability is enforced here unconditionally, matching the v1 createMessage body.
495+
if ((params.tools || params.toolChoice) && !this._clientCapabilities?.sampling?.tools) {
496496
throw new SdkError(SdkErrorCode.CapabilityNotSupported, 'Client does not support sampling tools capability.');
497497
}
498498

0 commit comments

Comments
 (0)