MCP Server: Validated Inputs, Custom Results, and Flat Arguments

Three updates to the MCP Server handler give you more control over how your tools accept input and what they send back to AI clients.

  • Validated inputs: Tool calls are checked against the input schema you declare before the request reaches your route
  • Custom tool results: Return a short summary to the model while keeping the full JSON in structured content
  • Flat arguments: Opt in to tools that take body fields and parameters as top-level arguments

Tool calls validated against your input schema

Every tools/call is now validated against the tool’s advertised input schema, which Zuplo derives from your OpenAPI operation. Arguments that don’t match are rejected with a JSON-RPC -32602 error, so bad input never reaches your handler or upstream.

Arguments a tool doesn’t declare are rejected, and an argument becomes an upstream header only when the operation declares that header parameter. Set additionalProperties: false on a request body schema to also reject body fields a model invents.

Control what a tool returns

setRawCallToolResult on ZuploMcpSdk now lets you override content, structuredContent, and _meta independently. A custom tool handler can give the model a compact text summary while structuredContent still carries the complete payload:

TypeScriptts
new ZuploMcpSdk(context).setRawCallToolResult({
  content: [{ type: "text", text: `Found ${orders.length} orders` }],
  structuredContent: { orders, count: orders.length },
});

When a tool advertises an output schema, the gateway checks the structured result against it before sending it, and includeOutputSchema now turns on includeStructuredContent as well. See Output schema enforcement.

Flat tool arguments

Set toolInputStyle: "flat" in the handler options to advertise each tool’s request body fields and path, query, and header parameters as top-level arguments, the shape most MCP clients send on a first call. The gateway routes each argument back to its body field or parameter. The default stays "nested", so existing tool schemas don’t change, and flat tools still accept nested arguments.

To change one tool without changing the rest of the server, set toolInputStyle in that route’s x-zuplo-route.mcp block. The per-tool value takes precedence over the handler option.

Getting started

See Tool input schemas for flat and nested examples and the cases where a tool stays nested, and the ZuploMcpSdk reference for result overrides.