Skip to content

MCP: models loop on empty tool arguments; validate required args before the call #545

Backlog

Description

@potench

A model that sends args: {} to an MCP tool with required parameters gets a server error, then sends the same empty call again. Ultimate could catch this before the call goes out, and stop a run of identical failing calls.

What happened

Four runs of one review agent on zai/fireworks:accounts/fireworks/routers/glm-5p3-flex (GLM 5.3 Flex), Ultimate 1f4a9c7a, Dec 3:

  • 216 tool results; 66 were mcp calls.
  • 61 of the 66 mcp calls sent args: {}.
  • 55 of the 66 failed, 54 of them on missing arguments.
  • The same empty call repeated up to 4 times in a row.

Call shape:

{"server": "tool-gateway", "tool": "tool_gateway_run_read_tool", "args": {}}

Replies were the server's own text, for example tool_gateway_run_read_tool requires tool_name, Missing required parameter: backend. and Missing value for parameter channel_id.

What main already does

On main (c1136211) a failed call gets toolHint appended, so the model now sees the schema after the server rejects the call. That helps a model that reads it. It does not help one that keeps dropping its arguments, and every attempt still costs a round trip to the server.

Proposed change

  1. Before client.callTool, check args against the required list of the tool's inputSchema (already in server.tools). When a required key is missing, return isError with "Missing required arguments: x, y" and the schema, without calling the server. Local tools already reject bad arguments this way.
  2. Optionally, after N identical failing calls (same tool, same arguments, same error) in one run, answer with a short "this exact call failed N times; change the arguments or stop" instead of calling again.

Item 1 is cheap and low risk: it only refuses calls the server would refuse anyway. Item 2 is harness-wide and needs a threshold choice.

Related

(via Christian's agent)

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions