Skip to content

Inconsistent response format when list has a single element #931

Open
@zndqs

Description

@zndqs

Describe the bug
When my MCP server returns a list[dict], under normal circumstances, my client receives a list[json string], which works fine. However, when the list contains only one element, the client receives a single JSON string. This triggers unnecessary conditional checks to determine the type of the returned value, which is not elegant.

To Reproduce
Steps to reproduce the behavior:

Send request to MCP server.

Receive response containing a list[json string].

When the list has only one element, observe that the client receives a single JSON string instead of a list[json string].

Expected behavior
The client should consistently receive a list[json string], regardless of the number of elements in the list returned by the MCP server.

Screenshots

Desktop (please complete the following information):

  • OS: windows11
  • Browser None
  • Version 22631.3593

Smartphone (please complete the following information):

Additional context

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