Skip to content

Errors from the MCP server (type: stdio) are not being handled as expected #2884

@yokonao

Description

@yokonao

Describe the bug

Goose appears to fail at properly handling errors from MCP servers (type: stdio). When an MCP server returns an error response, Goose gets stuck and eventually times out after 30 seconds instead of processing the error and providing appropriate feedback to the LLM.

To Reproduce
Steps to reproduce the behavior:

  1. Add the @modelcontextprotocol/server-everything as an extension in ~/.config/goose/config.yaml:
---
everything:
  args:
    - -y
    - "@modelcontextprotocol/server-everything"
  bundled: null
  cmd: npx
  description: null
  enabled: true
  env_keys: []
  envs: {}
  name: everything
  timeout: 30
  type: stdio
  1. Start goose from CLI
  2. Issue a tool call with incorrect parameter types: add "hogehoge" "fugafuga"
  3. Observe that Goose gets stuck and times out after 30 seconds

Expected behavior

Goose should properly handle the error response from the MCP server and provide immediate feedback to the LLM, allowing it to understand the error and continue processing. The error should not cause a timeout.

Screenshots

Actual Goose behavior (times out):

( O)> add "hogehoge" "fugafuga"

I'll add those two values for you using the add function.
─── add | everything ──────────────────────────
a: hogehoge
b: fugafuga


◓  Mapping memory mazes...
Execution failed: Call to 'example-servers/everything' failed for 'tools/call'. Error from mcp-server: request timed out

Expected MCP server response (immediate error):

$ npx -y @modelcontextprotocol/server-everything
Starting default (STDIO) server...
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"add","arguments":{"a":"hogehoge","b":"fugafuga"}}}
{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"number\",\n    \"received\": \"string\",\n    \"path\": [\n      \"a\"\n    ],\n    \"message\": \"Expected number, received string\"\n  },\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"number\",\n    \"received\": \"string\",\n    \"path\": [\n      \"b\"\n    ],\n    \"message\": \"Expected number, received string\"\n  }\n]"}}

Please provide following information:

  • OS & Arch: macOS
  • Interface: CLI
  • Version: 1.0.26
  • Extensions enabled: everything (@modelcontextprotocol/server-everything)
  • Provider & Model: claude-sonnet-4

Additional context

This issue suggests a problem with Goose's MCP server error handling mechanism. The MCP server correctly returns an error response immediately, but Goose fails to process this error response and instead waits until timeout. Proper error handling would allow the LLM to receive feedback about parameter type mismatches and adjust its approach accordingly.

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