Skip to content

MCP error -32602: Invalid arguments for tool #50

@Janene-Li

Description

@Janene-Li

2025-08-02 19:57:03,922 - INFO - HTTP Request: POST https://server.smithery.ai/exa/mcp?config=eyJkZWJ1ZyI6IGZhbHNlfQ==&api_key=3fcdd206-a7b0-43cc-af16-6916514ae32f&profile=shaggy-wombat-pKqPYL "HTTP/1.1 200 OK"
2025-08-02 19:57:03,922 - INFO - Received session ID: eyJpIjoiNjgzMjMzMmE2MGQ2MjgiLCJzIjoiMDE5ODZhYTQtODRmZS03ZjE2LWJiOTAtNTIyNGI0NGZlMzI3IiwidiI6MX0.UetZrQghWu_HjnjMByiQ9oFbRuxkQqZ8B9cPZk29BeY,9e3be9b1-fc3f-4907-9c76-71a27dd08214
2025-08-02 19:57:03,923 - INFO - Negotiated protocol version: 2025-03-26
session初始化成功
server name: exa;
tool name: deep_researcher_start;
tool args:{'instruction': 'What is the first name of the mother of the 15th First Lady of the United States?', 'model': 'exa-research'}

2025-08-02 19:57:04,206 - INFO - HTTP Request: POST https://server.smithery.ai/exa/mcp?config=eyJkZWJ1ZyI6IGZhbHNlfQ==&api_key=3fcdd206-a7b0-43cc-af16-6916514ae32f&profile=shaggy-wombat-pKqPYL "HTTP/1.1 202 Accepted"
2025-08-02 19:57:04,217 - INFO - HTTP Request: GET https://server.smithery.ai/exa/mcp?config=eyJkZWJ1ZyI6IGZhbHNlfQ==&api_key=3fcdd206-a7b0-43cc-af16-6916514ae32f&profile=shaggy-wombat-pKqPYL "HTTP/1.1 200 OK"
2025-08-02 19:57:04,490 - INFO - HTTP Request: POST https://server.smithery.ai/exa/mcp?config=eyJkZWJ1ZyI6IGZhbHNlfQ==&api_key=3fcdd206-a7b0-43cc-af16-6916514ae32f&profile=shaggy-wombat-pKqPYL "HTTP/1.1 200 OK"
2025-08-02 19:57:04,908 - INFO - HTTP Request: DELETE https://server.smithery.ai/exa/mcp?config=eyJkZWJ1ZyI6IGZhbHNlfQ==&api_key=3fcdd206-a7b0-43cc-af16-6916514ae32f&profile=shaggy-wombat-pKqPYL "HTTP/1.1 204 No Content"
调用mcp tools时出错:

  • Exception Group Traceback (most recent call last):
    | File "/home/enhan/NAMCP/proxy_server/server.py", line 107, in main
    | sub_mcp_result = await mcp_call_tool(server_name, tool_name, args_json)
    | File "/home/enhan/NAMCP/proxy_server/mcp_client/call_mcp_tool.py", line 83, in mcp_call_tool
    | async with streamablehttp_client(url) as (read, write, _):
    | File "/home/enhan/miniconda3/envs/MCP/lib/python3.10/contextlib.py", line 217, in aexit
    | await self.gen.athrow(typ, value, traceback)
    | File "/home/enhan/miniconda3/envs/MCP/lib/python3.10/site-packages/mcp/client/streamable_http.py", line 474, in streamablehttp_client
    | async with anyio.create_task_group() as tg:
    | File "/home/enhan/miniconda3/envs/MCP/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    | File "/home/enhan/miniconda3/envs/MCP/lib/python3.10/site-packages/mcp/client/streamable_http.py", line 498, in streamablehttp_client
    | yield (
    | File "/home/enhan/NAMCP/proxy_server/mcp_client/call_mcp_tool.py", line 84, in mcp_call_tool
    | async with mcp.ClientSession(read, write) as session:
    | File "/home/enhan/miniconda3/envs/MCP/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/home/enhan/NAMCP/proxy_server/mcp_client/call_mcp_tool.py", line 91, in mcp_call_tool
    | response = await session.call_tool(tool_name, tool_args)
    | File "/home/enhan/miniconda3/envs/MCP/lib/python3.10/site-packages/mcp/client/session.py", line 293, in call_tool
    | result = await self.send_request(
    | File "/home/enhan/miniconda3/envs/MCP/lib/python3.10/site-packages/mcp/shared/session.py", line 286, in send_request
    | raise McpError(response_or_error.error)
    | mcp.shared.exceptions.McpError: MCP error -32602: Invalid arguments for tool deep_researcher_start: [
    | {
    | "code": "invalid_type",
    | "expected": "string",
    | "received": "undefined",
    | "path": [
    | "instructions"
    | ],
    | "message": "Required"
    | }
    | ]
    +------------------------------------

sometimes this error happens, it seems like my args is wrong, but my args seems like in the right format:
{'instruction': 'What is the first name of the mother of the 15th First Lady of the United States?', 'model': 'exa-research'}

here's my code:
async with streamablehttp_client(url) as (read, write, _):
async with mcp.ClientSession(read, write) as session:
await session.initialize()
print(f"server name: {server_name};\n tool name: {tool_name};\n tool args:{tool_args}\n\n")
response = await session.call_tool(tool_name, tool_args)

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