Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Insufficient error details from SDK error handling #121

Open
masda70 opened this issue Jan 13, 2025 · 1 comment
Open

Error: Insufficient error details from SDK error handling #121

masda70 opened this issue Jan 13, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@masda70
Copy link

masda70 commented Jan 13, 2025

Describe the bug
The SDK's error handling does not provide sufficient error details when encountering complex error types. Notably, when an AggregateError is thrown (e.g., from pg.Pool.connect()), users only see "MCP error -32603" without any underlying error information that could help diagnose the issue.

To Reproduce

  1. Use any MCP server that may throw complex errors (e.g., @modelcontextprotocol/server-postgres with invalid connection)
  2. Observe that error messages lack important details
  3. Example: Database connection errors only show "MCP error -32603" instead of the actual connection error details stored in AggregateError.errors[]

Expected behavior
The error handling system should:

  1. Deeply inspect error objects to extract meaningful information
  2. Handle common error types appropriately (including but not limited to AggregateError)
  3. Present error information in a way that helps users diagnose issues

Additional context

  • The AggregateError case highlights a broader need for better error inspection
  • Different error types may store their important details in different properties
  • A more robust error inspection system would improve the debugging experience across all MCP servers
  • This could be designed as a general error handling enhancement, with AggregateError support being one of the initial use cases
@masda70 masda70 added the bug Something isn't working label Jan 13, 2025
@shanggqm
Copy link

shanggqm commented Jan 16, 2025

I met same error,I try harder to debug , but I don't know how to fix it。

-----> result: get-forecast 工具执行失败,失败原因:MCP error -32603: [ { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "params", "name" ], "message": "Required" } ]

my code is :

// create client
const transport = new StdioClientTransport({
      command: serverConfig.command,
      args: serverConfig.args,
      env: serverConfig.env
    });

// Create client
const client = new Client({
  name: serverConfig.name,
  version: '0.0.1',
}, {
  capabilities: {},
});

await client.connect(transport)


// call tool
const params = {"latitude": 34.0522, "longitude": -118.2437}
const result = await mcpClient.client.callTool(params);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants