Skip to content

Functionality to fetch output schemas as well on list_tools() #754

Open
@PratyushNag

Description

@PratyushNag

Is your feature request related to a problem? Please describe.
I was working on a project and was wondering if it was possible to fetch the output schemas as well on client.list_tools(). I realize that the output returned by MCP tools is often a string (or stringified JSON), and having information in advance about the structure of data I would be receiving would be helpful.

Describe the solution you'd like
Currently the list_tools() returns something like :

 {
        "meta": null,
        "nextCursor": null,
        "tools": [
          {
            "name": "get-news",
            "description": "Get the latest news for a given topic",
            "input_schema": {
              "type": "object",
              "properties": {
                "topic": {
                  "type": "string",
                  "description": "Topic to search for"
                },
                "page_size": {
                  "type": "number",
                  "description": "Number of results to return (1-25)"
                }
              },
              "required": [
                "topic",
                "page_size"
              ]
            },
            "annotations": null
          },
          {
            "name": "get-headlines",
            "description": "Get the latest headlines for a given country",
            "input_schema": {
              "type": "object",
              "properties": {
                "country": {
                  "type": "string",
                  "description": "Country code (2 letters)"
                },
                "page_size": {
                  "type": "number",
                  "description": "Number of results to return (1-25)"
                }
              },
              "required": [
                "country",
                "page_size"
              ]
            },
            "annotations": null
          }
        ]
      }

I'd like to also get the output schema for each tool alongside the input schema. If the output is a simple string, then just {"type": "string"} would be fine. But for JSON objects, getting the actual JSON schema being returned before stringification would be very helpful.

Describe alternatives you've considered
Current alternatives involve manually reading the MCP server code to determine the exact output schema (this is repetitive for each new MCP server we add) or sending a test request and then parsing the output to infer the schema (not feasible in many cases).

Since I'm using MCP with the client only, I don't have an agent to interpret the output on runtime and utilize that information dynamically.

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