MCP argument validation

Refuse invalid tool calls before any service code runs.

AI agents construct tool arguments themselves and sometimes get them wrong - a missing field, a hallucinated one, a string where a number belongs. With validation on, an MCP gateway checks every tools/call against the tool's input schema before the service runs, and refuses invalid calls with an error naming the offending field, which lets the agent correct itself and retry.

Validation is the Validate input against each tool's schema checkbox, in the Gateway options micro-form under More options on the wizard's step 02, What do they receive?, and in enmasse it is the validate_input attribute. It runs after authentication and session checks - an unauthenticated caller never gets as far as validation.

Validation rules

The schema is the one tools/list advertises, generated from the service's declared input - there is nothing separate to write or keep in sync. Against it, the gateway verifies:

  • The arguments element is a JSON object.
  • Every required field is present.
  • No field outside the schema is accepted.
  • Every value has its declared type - string, integer, number, boolean, array or object. A boolean does not pass as an integer or a number, and a null never matches - an optional field is expressed by absence, not by null.
  • Arrays with a declared element type have each element checked, and nested objects recurse with the full rules above.

What a service with no declared input accepts is described under tool schemas.

Error responses

An invalid call is refused with JSON-RPC error -32602 and a message that names the field with its full path:

{
    "jsonrpc": "2.0",
    "id": 7,
    "error": {
        "code": -32602,
        "message": "Missing required parameter: `customer_id`"
    }
}

The messages are:

MessageCause
Invalid arguments: expected an objectThe arguments element is not a JSON object
Missing required parameter: `path`A required field is absent
Unknown parameter: `path`A field outside the schema was sent
Invalid type for `path`: expected integerA value has the wrong type - the path descends into nested objects and arrays, e.g. customer.addresses[2].zip_code

With the audit log on, refused calls are recorded with an error outcome and the error message, so systematically failing agents are visible in the dashboard.

See also

FeatureWhat it does
Tool schemasThe generated schema that calls are checked against
Response controlsShaping applied to responses after the service runs
Audit logHow refused calls are recorded
Tool selectionAn agent corrected by validation errors, end to end

Learn more