feat(client): return empty lists when server lacks capability (#1386)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Konstantin Konstantinov <KKonstantinov@users.noreply.github.com> Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
This commit is contained in:
parent
4b5fdcba02
commit
00249ce86d
1 changed files with 113 additions and 3 deletions
13
.changeset/respect-capability-negotiation.md
Normal file
13
.changeset/respect-capability-negotiation.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
'@modelcontextprotocol/client': patch
|
||||
---
|
||||
|
||||
Respect capability negotiation in list methods by returning empty lists when server lacks capability
|
||||
|
||||
The Client now returns empty lists instead of sending requests to servers that don't advertise the corresponding capability:
|
||||
- `listPrompts()` returns `{ prompts: [] }` if server lacks prompts capability
|
||||
- `listResources()` returns `{ resources: [] }` if server lacks resources capability
|
||||
- `listResourceTemplates()` returns `{ resourceTemplates: [] }` if server lacks resources capability
|
||||
- `listTools()` returns `{ tools: [] }` if server lacks tools capability
|
||||
|
||||
This respects the MCP spec requirement that "Both parties SHOULD respect capability negotiation" and avoids unnecessary server warnings and traffic. The existing `enforceStrictCapabilities` option continues to throw errors when set to `true`.
|
||||
Loading…
Reference in a new issue