Skip to content

MCP error -32602: Invalid tools/call result #135

@erhhung

Description

@erhhung

Having trouble getting the weather-mcp-server example working:

$ echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | node dist/index.js

[2026-01-29T03:00:04.386Z] [INFO] Initializing MCP Server: weather-server@0.1.0
[2026-01-29T03:00:04.389Z] [INFO] Starting MCP server: (Framework: 0.2.16, SDK: 1.25.3)...
[2026-01-29T03:00:04.437Z] [INFO] Capabilities detected: {"tools":{}}
[2026-01-29T03:00:04.445Z] [INFO] Connecting transport (stdio) to SDK Server...
[2026-01-29T03:00:04.446Z] [INFO] Started weather-server@0.1.0 successfully on transport stdio
[2026-01-29T03:00:04.446Z] [INFO] Tools (1): weather
[2026-01-29T03:00:04.446Z] [INFO] Server running and ready.

{"result":{"tools":[{"name":"weather","description":"Get weather information for a city","inputSchema":{"type":"object","properties":{"city":{"type":"string","description":"City name to get weather for"}},"required":["city"]}}]},"jsonrpc":"2.0","id":2}
$ echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"weather","arguments":{"city":"London"}}}' | \
    node dist/index.js

[2026-01-29T03:05:39.676Z] [INFO] Initializing MCP Server: weather-server@0.1.0
[2026-01-29T03:05:39.679Z] [INFO] Starting MCP server: (Framework: 0.2.16, SDK: 1.25.3)...
[2026-01-29T03:05:39.730Z] [INFO] Capabilities detected: {"tools":{}}
[2026-01-29T03:05:39.740Z] [INFO] Connecting transport (stdio) to SDK Server...
[2026-01-29T03:05:39.740Z] [INFO] Started weather-server@0.1.0 successfully on transport stdio
[2026-01-29T03:05:39.741Z] [INFO] Tools (1): weather
[2026-01-29T03:05:39.741Z] [INFO] Server running and ready.

{"jsonrpc":"2.0","id":3,"error":{"code":-32602,"message":"MCP error -32602: Invalid tools/call result: ...

$ echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"weather","arguments":{"city":"London"}}}' | \
    node dist/index.js 2> /dev/null | jq -r .error.message

MCP error -32602: Invalid tools/call result: [
  {
    "code": "invalid_union",
    "errors": [
      [
        {
          "code": "invalid_value",
          "values": [
            "text"
          ],
          "path": [
            "type"
          ],
          "message": "Invalid input: expected \"text\""
        }
      ],
      [
        {
          "code": "invalid_value",
          "values": [
            "image"
          ],
          "path": [
            "type"
          ],
          "message": "Invalid input: expected \"image\""
        },
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "data"
          ],
          "message": "Invalid input: expected string, received undefined"
        },
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "mimeType"
          ],
          "message": "Invalid input: expected string, received undefined"
        }
      ],
      [
        {
          "code": "invalid_value",
          "values": [
            "audio"
          ],
          "path": [
            "type"
          ],
          "message": "Invalid input: expected \"audio\""
        },
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "data"
          ],
          "message": "Invalid input: expected string, received undefined"
        },
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "mimeType"
          ],
          "message": "Invalid input: expected string, received undefined"
        }
      ],
      [
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "name"
          ],
          "message": "Invalid input: expected string, received undefined"
        },
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "uri"
          ],
          "message": "Invalid input: expected string, received undefined"
        },
        {
          "code": "invalid_value",
          "values": [
            "resource_link"
          ],
          "path": [
            "type"
          ],
          "message": "Invalid input: expected \"resource_link\""
        }
      ],
      [
        {
          "code": "invalid_value",
          "values": [
            "resource"
          ],
          "path": [
            "type"
          ],
          "message": "Invalid input: expected \"resource\""
        },
        {
          "code": "invalid_union",
          "errors": [
            [
              {
                "expected": "object",
                "code": "invalid_type",
                "path": [],
                "message": "Invalid input: expected object, received undefined"
              }
            ],
            [
              {
                "expected": "object",
                "code": "invalid_type",
                "path": [],
                "message": "Invalid input: expected object, received undefined"
              }
            ]
          ],
          "path": [
            "resource"
          ],
          "message": "Invalid input"
        }
      ]
    ],
    "path": [
      "content",
      0
    ],
    "message": "Invalid input"
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions