Prompier
ApprovedEngineeringapi

Tool definition design for AI assistants

PL by Prompier Library ☆☆☆☆☆ New Version 1 · updated Nov 10, 2026
Reviewed by moderator Prompier Library on Nov 10, 2026. Checked for personal data, secrets, risky instructions and a clear license.

About this prompt

Designs a clear, validated tool (function) definition that AI assistants can call reliably: naming, parameters, field order, output and error shapes, safety rules and example calls. Use it when connecting an assistant to your own APIs.

Prompt text

You are an API designer specializing in tools that AI assistants call. Design a tool definition that an assistant will use correctly on the first try and that fails safely when it does not. Inputs - What the tool should let the assistant do: {{tool_purpose}} - The underlying operation (what it reads or changes, side effects, permissions): {{backend_operation}} - Which assistants or frameworks will call it: {{callers}} - Misuse or failures seen so far, if any: {{known_failures}} How to work 1. Decide whether this should be one tool or several. If one tool would both read and write, or take very different parameter sets per mode, split it and say so. 2. Name it as a verb and object (for example create_invoice), scoped and unambiguous. 3. Write the description as an instruction: when to call it, when not to, and what to check first. Keep it short. 4. Design parameters: flat where possible, explicit names with units (amount_cents, timeout_seconds), enums instead of free text where values are known, required versus optional, and exactly what happens when an optional field is omitted. One meaning per field. 5. If the tool returns structured reasoning or results, order fields so supporting details come before conclusions, and confidence notes after the conclusion they describe. 6. Each parameter description should be a directive with a failure rule, for example 'If unknown, omit; do not guess'. 7. Design the output to separate status, data and error. Define error categories, each marked retryable or not, with a message the assistant can act on. 8. For side effects, require stronger preconditions: an explicit confirmation field or a dry-run mode, and an idempotency key so retries do not repeat the action. 9. Write example calls, including one the tool should reject and why. Output format Tool purpose / Invocation rules / Input fields table (Name, Type, Required, Meaning, Default if omitted) / Output shape / Error model / Safety constraints / Example calls / Validation rules / Final schema draft in a code block. Quality bar - No overloaded fields and no hidden defaults. - No output that mixes status and payload. - Do not expose internal identifiers or secrets in descriptions or examples.

Variables

4 variables
VariableWhat to enterExampleDefault
{{tool_purpose}}What the tool should let the assistant doLook up an order's status by order number—
{{backend_operation}}What it reads or changes, side effects and permissionsRead-only query on the orders database, limited to the caller's own customers—
{{callers}}Which assistants or frameworks will call itOur support chat assistant and an internal agent framework—
{{known_failures}}Mistakes you have already seen, or write 'none'Assistant passes the customer's name instead of the order number—

Try it

Live preview
What the tool should let the assistant do
What it reads or changes, side effects and permissions
Which assistants or frameworks will call it
Mistakes you have already seen, or write 'none'
Your finished prompt
You are an API designer specializing in tools that AI assistants call. Design a tool definition that an assistant will use correctly on the first try and that fails safely when it does not. Inputs - What the tool should let the assistant do: {{tool_purpose}} - The underlying operation (what it reads or changes, side effects, permissions): {{backend_operation}} - Which assistants or frameworks will call it: {{callers}} - Misuse or failures seen so far, if any: {{known_failures}} How to work 1. Decide whether this should be one tool or several. If one tool would both read and write, or take very different parameter sets per mode, split it and say so. 2. Name it as a verb and object (for example create_invoice), scoped and unambiguous. 3. Write the description as an instruction: when to call it, when not to, and what to check first. Keep it short. 4. Design parameters: flat where possible, explicit names with units (amount_cents, timeout_seconds), enums instead of free text where values are known, required versus optional, and exactly what happens when an optional field is omitted. One meaning per field. 5. If the tool returns structured reasoning or results, order fields so supporting details come before conclusions, and confidence notes after the conclusion they describe. 6. Each parameter description should be a directive with a failure rule, for example 'If unknown, omit; do not guess'. 7. Design the output to separate status, data and error. Define error categories, each marked retryable or not, with a message the assistant can act on. 8. For side effects, require stronger preconditions: an explicit confirmation field or a dry-run mode, and an idempotency key so retries do not repeat the action. 9. Write example calls, including one the tool should reject and why. Output format Tool purpose / Invocation rules / Input fields table (Name, Type, Required, Meaning, Default if omitted) / Output shape / Error model / Safety constraints / Example calls / Validation rules / Final schema draft in a code block. Quality bar - No overloaded fields and no hidden defaults. - No output that mixes status and payload. - Do not expose internal identifiers or secrets in descriptions or examples.

Sample output

Tool purpose: let the assistant issue a refund for a single order. Split decision: separate from get_order; reading and refunding have different risk. Name: refund_order Description: Refund all or part of one paid order. Call only after the user has confirmed the amount. Never call for orders older than 90 days; tell the user to contact support. | Name | Type | Required | Meaning | Default if omitted | |---|---|---|---|---| | order_id | string | yes | Order to refund, as shown to the customer | - | | amount_cents | integer | no | Partial amount in cents | Full remaining amount | | reason | enum: damaged, late, wrong_item, other | yes | Why the refund is issued | - | | confirmed_by_user | boolean | yes | Must be true; the user approved this amount | - | | idempotency_key | string | yes | Unique per refund attempt | - | Output: { status: ok or error, refund: {...} or null, error: { category, retryable, message } or null } Errors: order_not_found (not retryable), amount_exceeds_paid (not retryable), payment_service_timeout (retryable)...

An example the author shared. Your result will differ.

Reviews

No written reviews yet. If you have used this prompt, tell others how it went.