PromptFork

Bulletproof tool-calling JSON schema for AI agents

Design strict, self-validating tool schemas with confidence calibration, discriminated unions, and chain-ready contracts — so your agent calls tools reliably instead of hallucinating arguments.

Open in Studio
Prompt
You are a tool-schema architect who thinks in failure modes first. I need a tool called [TOOL NAME] that [WHAT IT DOES]. Context: [AGENT'S OVERALL JOB — what other tools exist, what triggers this one].

Design the schema by working backwards from misuse — ask yourself 'how will the model screw this up?' for every field, then constrain it.

Produce:

1. **JSON Schema** for the tool's parameters:
- Every property gets a `description` written FOR THE MODEL: what the field is, its exact format, a concrete example value, and when to use vs. omit it.
- Use `enum` for fixed value sets, `const` for single-valued fields, `pattern` for format constraints, and `format` for standard types (date-time, uri, email).
- For any field that can be one of several shapes, use the **discriminated union pattern**: a `type` enum field plus `oneOf`/`if-then` blocks keyed to it — never a loose `object` with optional fields that change meaning.
- Mark exactly the right fields `required`. Set `additionalProperties: false` on every object level.
- Include a `_confidence` field (number, 0–1) in the schema — the model must self-report how certain it is that this tool call is the right action. If confidence < 0.7, the orchestrator can route to human review.

2. **Tool definitions** in both OpenAI function-calling format and Anthropic tool format, side by side.

3. **System-prompt snippet** (one paragraph): tell the model exactly when to call this tool vs. answer directly, what confidence threshold justifies a call, and what to do when the tool's output feeds into a downstream tool call (the **tool-calling chain** contract: specify what fields from this tool's response become input to the next tool, and instruct the model to extract — not paraphrase — them).

4. **5 edge-case test inputs**, each with:
- The user message that triggers it
- The expected tool-call JSON
- Why this case is tricky (ambiguous entity, missing optional field, boundary value, type coercion trap, or chain-input extraction)
- Whether the model should call the tool at all (include 1–2 cases where the right answer is 'don't call it')

5. **Validation checklist**: 3 things to assert in your orchestrator code before executing the call (type-check, business-logic guard, chain-input presence).
Source
promptfork seed
License
CC-BY-4.0
Published
6/23/2026

More prompts you might like

Zapier multi-step Zap to route and enrich new leads

A step-by-step Zap blueprint: trigger, filter, enrich, branch by score, and notify the right channel.

New

Notion task database with smart formulas, automations, and role-based views

Design a Notion task system with genuinely useful formulas (overdue countdown, auto-archive logic, conditional formatting), native automations, and filtered views for different team roles.

New

Make.com scenario blueprint with error handling, rate limits, and operations budgeting

Blueprint a Make.com scenario with exact module configs, exponential backoff retry logic, data transformation pitfalls to avoid, and specific operations-saving patterns like early-filter routing.

New
Editor’s pickAutomation & AgentsSeed

Orchestrate a multi-agent team to ship one task

Turn a goal into a coordinated planner→worker→critic agent workflow with clear handoffs and a stop condition.

New

Write a brand-aligned support-agent system prompt with escalation rules

Produces a complete system prompt that defines a support agent's persona, voice, knowledge boundaries, and exact escalation rules — brand-aligned and safe to ship, not a generic 'be helpful'.

#customer-support#system-prompt
New

Design a support-ticket triage agent that classifies and prioritizes

Produces a system prompt and routing logic that classifies incoming tickets by intent, urgency, and language — then routes to the right queue with a priority and confidence score, so nothing critical sits in a generic inbox.

#customer-support#triage
New