Skip to main content
Glama
ms-methos

jsonfabrica-mcp-server

Create a JsonFabrica batch generation job

jsonfabrica_create_batch

Generate multiple JSON documents from persisted templates in a single request, with optional cross-document relations. Avoids looping single-generation calls for large or relational batches.

Instructions

Calls POST /v1/batches. Generates multiple documents from one or more persisted templates in one call, optionally cross-referencing documents via relations — use this instead of looping jsonfabrica_generate_from_template yourself when you need many documents or cross-document relations in a single request. Small batches run synchronously and the response is 200 with results; larger batches are queued and the response is 202 with just { batchId, status, seed } — poll jsonfabrica_get_batch for the final results in that case. Like a single generate call, this is metered/billed per document produced and, unless namespaced, can advance real durable sequences and mutate durable variables referenced by the templates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
seedNoDeterministic PRNG seed applied across the whole batch — the same seed reproduces byte-identical random values for every document. Optional; if omitted the server picks a random seed and returns it in the response (`seed` in both sync and async cases).
documentsYesOne entry per group of documents to generate, each naming a `templateId`, a unique `alias`, how many (`count`) to generate, and optionally `relations`/`params`. Required; at least one entry. Entries are executed in dependency order (documents with `relations` are generated after the aliases they depend on).
sequenceNamespaceNoIsolates createSeq()/getSeq() durable-sequence side effects for this whole batch under this namespace, so test/debug runs don't advance real tenant sequences. Optional; omitted means the default (unnamespaced) sequence scope is used.
variableNamespaceNoIsolates durable-variable side effects for this whole batch under this namespace, analogous to `sequenceNamespace`. Optional; omitted means the default (unnamespaced) variable scope is used.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
seedNoPRNG seed used/assigned for the whole batch.
errorNoPresent if the whole batch failed.
statusNoBatch status at response time.
batchIdNoId of the created batch.
resultsNoPresent only for synchronous (200) responses.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changed
    • addedInput schema / properties / documents / description
      Added value: +"One entry per group of documents to generate, each naming a `templateId`, a unique `alias`, how many (`count`) to generate, and optionally `relations`/`params`. Required; at least one entry. Entries are executed in dependency order (documents with `relations` are generated after the aliases they depend on)."
    • addedInput schema / properties / documents / items / properties / alias / description
      Added value: +"Short name identifying this `documents[]` entry within the batch, used to reference it from other entries' `relations` (and duplicated aliases across entries are rejected with a 400 error). Required."
    • addedInput schema / properties / documents / items / properties / count / description
      Added value: +"How many documents to generate from this template within the batch. Required; must be an integer."
    • addedInput schema / properties / documents / items / properties / params / description
      Added value: +"Key/value map supplying values for getParam(\"key\") placeholders in this template's body, applied to every document generated for this alias. Optional; omitted keys leave the corresponding getParam() calls unresolved/empty."
    • changedInput schema / properties / documents / items / properties / relations / additionalProperties / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "properties": {
      -      "from": {
      -        "type": "string"
      -      },
      -      "strategy": {
      -        "enum": [
      -          "by-index",
      -          "round-robin"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "description": "Shorthand relation reference in the form \"parentAlias\" or \"parentAlias.field.nested\", pointing at a document from another `documents[]` entry (by its `alias`). Only valid when the referenced parent has `count === 1` — with `count > 1` the reference is ambiguous and the request is rejected with a 400 error; use the object form with `strategy` instead.",
      +    "type": "string"
      +  },
      +  {
      +    "properties": {
      +      "from": {
      +        "description": "Same \"parentAlias\" or \"parentAlias.field.nested\" reference as the string form, but required here so a `strategy` can be attached — used when the referenced parent has `count > 1`.",
      +        "type": "string"
      +      },
      +      "strategy": {
      +        "description": "How to pick one of several parent documents when the referenced alias has `count > 1`. Only \"round-robin\" is currently supported (cycles through the parent's generated documents in order, wrapping around); any other value is rejected with a 400 UNSUPPORTED_STRATEGY error. Optional, but effectively required whenever the parent alias has `count > 1`.",
      +        "enum": [
      +          "round-robin"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  }
      +]
    • addedInput schema / properties / documents / items / properties / relations / description
      Added value: +"Map of field name (as it appears in this template's generated output) to a reference into another alias in the same batch, letting generated documents cross-reference each other (e.g. an \"orders\" entry referencing a \"customers\" entry's id). Optional; omit for documents with no cross-references. Unknown aliases or dependency cycles across `documents[]` are rejected with a 400 error."
    • addedInput schema / properties / documents / items / properties / templateId / description
      Added value: +"ID of the persisted template used to generate this document group. Required."
    • addedInput schema / properties / seed / description
      Added value: +"Deterministic PRNG seed applied across the whole batch — the same seed reproduces byte-identical random values for every document. Optional; if omitted the server picks a random seed and returns it in the response (`seed` in both sync and async cases)."
    • addedInput schema / properties / sequenceNamespace / description
      Added value: +"Isolates createSeq()/getSeq() durable-sequence side effects for this whole batch under this namespace, so test/debug runs don't advance real tenant sequences. Optional; omitted means the default (unnamespaced) sequence scope is used."
    • addedInput schema / properties / variableNamespace / description
      Added value: +"Isolates durable-variable side effects for this whole batch under this namespace, analogous to `sequenceNamespace`. Optional; omitted means the default (unnamespaced) variable scope is used."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "batchId": {
      +      "description": "Id of the created batch.",
      +      "type": "string"
      +    },
      +    "error": {
      +      "additionalProperties": false,
      +      "description": "Present if the whole batch failed.",
      +      "properties": {
      +        "code": {
      +          "type": "string"
      +        },
      +        "message": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "code",
      +        "message"
      +      ],
      +      "type": "object"
      +    },
      +    "results": {
      +      "description": "Present only for synchronous (200) responses.",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "alias": {
      +            "description": "The `documents[]` alias this document was generated for.",
      +            "type": "string"
      +          },
      +          "batchId": {
      +            "description": "Id of the batch this document belongs to.",
      +            "type": "string"
      +          },
      +          "documentSeed": {
      +            "description": "Per-document PRNG seed actually used.",
      +            "type": "number"
      +          },
      +          "result": {
      +            "description": "The generated document; shape depends on the template body. Absent while pending/failed."
      +          },
      +          "seqNo": {
      +            "description": "0-based index of this document within its alias group.",
      +            "maximum": 9007199254740991,
      +            "minimum": -9007199254740991,
      +            "type": "integer"
      +          },
      +          "status": {
      +            "description": "Per-document generation status.",
      +            "enum": [
      +              "pending",
      +              "completed",
      +              "failed"
      +            ],
      +            "type": "string"
      +          },
      +          "templateId": {
      +            "description": "Template used to generate this document.",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "batchId",
      +          "alias",
      +          "seqNo",
      +          "templateId",
      +          "status"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "seed": {
      +      "description": "PRNG seed used/assigned for the whole batch.",
      +      "type": "number"
      +    },
      +    "status": {
      +      "description": "Batch status at response time.",
      +      "enum": [
      +        "queued",
      +        "running",
      +        "completed",
      +        "failed"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. First observedv0.1.4

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description goes well beyond the annotations (which only set readOnlyHint=false, openWorldHint=true, idempotentHint=false, destructiveHint=false) by detailing side effects: it can 'advance real durable sequences and mutate durable variables' unless namespaced, and notes per-document billing. It also discloses the async behavior with 200 vs 202 responses and polling, which is critical for correct invocation. No contradictions with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two well-structured sentences that pack essential information: the first states the endpoint and core function, the second covers sync/async behavior and side effects. It is front-loaded with the purpose and avoids redundancy, making it efficient for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, the description provides comprehensive context: it covers when to use it, how it behaves synchronously vs asynchronously, billing implications, and side-effect risks with namespace mitigation. Since an output schema exists, return value details are not required in the description. Everything an agent needs to correctly call and interpret the result is present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% coverage with detailed descriptions for all parameters, so the baseline is 3. The description adds minimal parameter-specific meaning beyond the schema—it mentions the relations cross-referencing concept and namespacing side effects, but these are already explained in the schema properties. The description does not introduce new parameter semantics not covered by the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Generates multiple documents from one or more persisted templates in one call' and explicitly distinguishes it from the sibling jsonfabrica_generate_from_template by recommending this tool 'instead of looping' when many documents or cross-document relations are needed. This makes the purpose unambiguous and differentiates it from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use guidance: 'use this instead of looping jsonfabrica_generate_from_template yourself when you need many documents or cross-document relations in a single request.' It also explains the sync vs async behavior and directs the agent to poll jsonfabrica_get_batch for async results, giving clear context on when to expect different response types.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.