modelcontextprotocol / modelcontextprotocol/rust-sdk

Empty cacheScope on tools/list drops every tool

Open Beginner friendly
#1,242 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2 ready for work T-model
Dominant language
Rust
Stars
3.9k
Forks
645
Avg merge
4d 13h
Merged PRs (30d)
36

Description

Describe the bug

Some hosted MCP servers send cacheScope: "" on tools/list and resources/read results. SEP-2549 only allows "public", "private", or omitting the field, so serde rejects the empty string. Because ServerResult is an untagged enum, that failure does not stay on ListToolsResult. The payload falls through to CustomResult, and the client ends up with no tools.

Negative ttlMs is already normalized. Empty cacheScope is not.

To Reproduce

Deserialize a valid tools/list result that includes an empty cache scope:

{
  "tools": [{ "name": "search", "inputSchema": { "type": "object" } }],
  "ttlMs": 0,
  "cacheScope": ""
}

On current main this does not parse as ListToolsResult.

Expected behavior

Treat an exact empty cacheScope the same as an omitted field (None). Unknown values such as "shared" or " " should still fail.

Additional context

I hit this against a hosted server that emits cacheScope: "" on an otherwise valid tools/list body. The tools were present on the wire and disappeared after decode.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the serde deserialization for cacheScope in the tools/list and resources/read result types, then reproduce the provided JSON as a focused test. Done means an exact empty string is treated like an omitted field, tools remain available, and values such as "shared" or " " still fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.