Function Call Mock Response Generator

Generate realistic mock tool-call responses from a JSON Schema for testing LLM integrations.

Paste an OpenAI or Anthropic tool/function schema and the tool generates plausible mock JSON responses that satisfy the parameter types, so you can test your tool-use parsing code locally without spending API calls. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What schema formats are supported?

It accepts the OpenAI function shape (with a function.parameters object), the Anthropic tool shape (with an input_schema object), or a bare JSON Schema object. It reads the parameters block from whichever it finds.

Function call mock generator

Building the code that handles an LLM’s tool calls means you need example tool-call payloads to test against — but calling the real API for each one is slow and costs tokens. This tool reads your function/tool JSON Schema and synthesises type-correct mock arguments, giving you instant fixtures for your parsing and handler logic.

How it works

The input is parsed as JSON and the tool locates the parameters schema — under function.parameters (OpenAI), input_schema (Anthropic), or at the top level (bare JSON Schema). It then walks the schema recursively:

  • enum fields take their first option (real, allowed values)
  • Strings derive a plausible value from the property name — an email field becomes [email protected], a userId becomes user_123
  • Numbers take the midpoint of minimum/maximum if declared, otherwise default to 0
  • Booleans default to true
  • Arrays produce two sample items of the declared item type
  • Nested objects recurse through all their properties

Generation is deterministic: the same schema always yields the same mock. The result is wrapped in a realistic tool-call envelope — including id, type, and function.name — that you can paste straight into a test fixture.

Worked example

For an OpenAI-style schema like this:

{
  "name": "create_order",
  "parameters": {
    "type": "object",
    "properties": {
      "product_id": { "type": "string" },
      "quantity":   { "type": "integer", "minimum": 1, "maximum": 100 },
      "priority":   { "type": "string", "enum": ["low", "normal", "high"] }
    },
    "required": ["product_id", "quantity"]
  }
}

The generator produces a mock tool call like:

{
  "id": "call_mock_abc123",
  "type": "function",
  "function": {
    "name": "create_order",
    "arguments": "{\"product_id\":\"product_id_value\",\"quantity\":50,\"priority\":\"low\"}"
  }
}

You can feed this directly into the handler under test, or adapt the values by hand before using it as a fixture.

When this is most useful

  • Unit-testing handler functions that parse arguments strings and call downstream services — no API tokens needed.
  • Integration testing schemas across OpenAI and Anthropic formats without maintaining two separate fixture files.
  • Rapid prototyping when you want to see what a handler receives before the real model is wired in.
  • CI/CD pipelines where deterministic, cost-free fixtures prevent flaky tests and token spend from test suites.

Tips and limitations

  • Every property is included. The generator emits all defined properties, not just the required ones, so the mock exercises your full parsing path.
  • Use enums for realistic values. The generator picks the first enum option — a real, allowed value — making the mock more meaningful than a generic placeholder.
  • It validates structure, not semantics. The mock satisfies the schema’s type constraints; it will not invent business-meaningful data. Adjust specific values by hand where your tests assert on exact content (for example, a specific order ID format).