Skip to content

[Bug]: tools/call without arguments is rejected with -32602 even when the tool has no required fields #1360

Description

@ondraulehla

Server type

Hosted (mcp.apify.com) and local (stdio via @apify/actors-mcp-server)

MCP Client

Other: raw JSON-RPC 2.0 probes (newline-delimited over stdio, plain POSTs
over streamable HTTP), no MCP client library, so the reproduction below is
exact requests

Operating System

macOS

What happened?

tools/call with the arguments key omitted is rejected with JSON-RPC
-32602 before validation runs. The MCP spec marks
CallToolRequest.params.arguments as optional (the SDK's
CallToolRequestSchema has arguments: z.ZodOptional<...>), so omitting
the key for a tool with no required fields is spec-conformant, but every
such call fails. search-actors declares "required": [] and every field
has a default; the identical call with arguments: {} succeeds.

I reproduced this on hosted mcp.apify.com (serverInfo 0.15.4, streamable
HTTP), on the published npm 0.15.4 over stdio, and on master 4bf6ecb
over stdio. All three behave the same:

Call Result
search-actors, no arguments key -32602 "Missing arguments for tool"
search-actors, arguments: {} ok, 5 Actors
fetch-actor-details, no arguments key -32602 "Missing arguments for tool"
fetch-actor-details, arguments: {} -32602 "root: must have required property 'actor'"

The fourth row shows a secondary cost: for a tool that does have required
fields, the blanket guard masks the specific validation message that #337
standardized. With {} the client learns which property is missing; without
the key it gets the generic text plus the fetch-actor-details pointer,
which is dead advice for internal tools (that pointer is #1214).

The guard is if (!args) in src/mcp/tool_call_engine.ts:171, surfaced as
McpError(InvalidParams) in src/mcp/legacy_server.ts:469. It predates the
shared validation (git log -S traces it to #28), and both protocol
adapters run it through prepareToolCall (legacy_server.ts:426,
stateless_server.ts:213); I verified the stateless path through the unit
harness with the same result.

This is not a synthetic client shape. A stock mark3labs/mcp-go v1.0.0
client with Arguments unset sends (captured on the wire via tee):

{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search-actors"}}

because the field is declared with json:"arguments,omitempty", and every
such call fails with the -32602 above; with an empty map it succeeds.
(The official modelcontextprotocol/go-sdk is unaffected: its CallTool
normalizes unset arguments to {}.) On 0.15.4, four tools declare no
required fields and each fails this way: search-actors,
get-actor-run-list, get-dataset-list, get-key-value-store-list.

Steps to reproduce

  1. Start the server with no token:
    node dist/stdio.js --tools search-actors,fetch-actor-details --telemetry-enabled false
    (env APIFY_TOKEN="").
  2. Complete initialize and send notifications/initialized.
  3. Send {"method":"tools/call","params":{"name":"search-actors"}} (no
    arguments key).
  4. Send the same call with "arguments": {}.

Expected result

The two calls behave the same: an omitted arguments validates as an empty
object, so search-actors runs with its defaults, and a tool with required
fields returns the specific -32602 from the shared validation.

Actual result

Step 3 returns:

{"code":-32602,"message":"MCP error -32602: Missing arguments for tool \"search-actors\".\nPlease provide the required arguments for this tool. Check the tool's input schema using fetch-actor-details tool to see what parameters are required."}

Step 4 returns the search results (5 Actors).

Node.js version

v24.2.0

Apify MCP Server version

Hosted mcp.apify.com (serverInfo 0.15.4), published npm 0.15.4, and
master 4bf6ecb built from source

MCP server configuration

{
  "command": "node",
  "args": ["dist/stdio.js", "--tools", "search-actors,fetch-actor-details", "--telemetry-enabled", "false"],
  "env": { "APIFY_TOKEN": "", "TELEMETRY_ENABLED": "false" }
}

Error logs

No transport or server error. The failure is the JSON-RPC error response
above.

Additional context

Defaulting an absent arguments to {} before validation would fix both
rows at once: no-required tools run, and required-field tools get the
specific validation error from #337.

AI assistance: I used Claude Code to search the codebase and to script and
run the JSON-RPC probes. I reviewed the requests, the cited source lines,
and this text myself; every result above comes from those runs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-aiIssues owned by the AI team.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions