Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-capability-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@modelcontextprotocol/sdk": patch
---

fix: throw SdkError for unsupported capabilities in assertCapability()
6 changes: 6 additions & 0 deletions test/integration/test/client/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@ test('should respect server capabilities', async () => {
argument: { name: 'test', value: 'test' }
})
).rejects.toThrow('Server does not support completions');

// Verify that unsupported capability errors are SdkError with CapabilityNotSupported code
await expect(client.listPrompts()).rejects.toThrow(SdkError);
await expect(client.listPrompts()).rejects.toMatchObject({
code: SdkErrorCode.CapabilityNotSupported
});
});

/***
Expand Down
Loading