Skip to content

Empty cacheScope on tools/list drops every tool #1242

Description

@ismail-rt

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions