- Trigger
- Billing system API key
- Steps
- 8, three at the top level
- Waits for
- The finance lead, until they answer
- Uses
- Billing tool server
How it works
- Read. Ask the model turns the billing system’s message into an amount, a customer and the invoice it refunds.
- Check. If the amount is over $500, the run stops and asks whether to approve. Smaller refunds skip the question.
- Decide. A decline ends with a reply giving the reason. Anything else goes on to payment.
- Pay. Call a tool issues the refund through the billing tool server.
- Reply. The last model step tells the billing system the refund was issued and gives its refund id. That reply is the run’s result.
Starting it and answering
The billing system starts a run with its API key and the customer’s message as the Prompt. When a refund is over $500, it receives wait.intervention.raised on the run’s stream, shows the question to the finance lead, and posts their answer to POST /workflow/runs/{runId}/waits/{waitId}. The run keeps its place for as long as that takes.
The workflow
Workflow: RefundApproval
Description: Reads a refund request, asks before paying anything over $500, and issues the refund.
Triggers:
- New: Refund
Schema:
type: object
required: [Prompt]
properties:
Prompt: { type: string }
Operations:
- Tool: IssueRefund
Locator: mcp://4b1e9a52-0f3c-4d2a-9e61-2a7f5c3d8b10/issue_refund
- Wait: Clarification
Locator: embedded://momor.ai/services/tools/clarification
Output: Content
Steps:
- ModelCall: Read
Instructions: Read the refund request. Return the amount, the customer and the invoice it refunds.
Output:
Structured:
type: object
required: [Amount, Customer, Invoice]
properties:
Amount: { type: number }
Customer: { type: string }
Invoice: { type: string }
- Branch: Check
Cases:
- When: { GreaterThan: { Field: Read.Amount, Value: 500 } }
Then:
- Wait: Approve
Operation: Clarification
Question: This refund is over $500. Approve it?
- Branch: Decision
Cases:
- When: { Exists: { Field: Check.Declined } }
Then:
- ModelCall: Declined
Instructions: Tell the billing system the refund was declined, and give the reason.
Output: Content
Else:
- ExecuteTool: Pay
Operations: [IssueRefund]
Input:
invoice: { Field: Read.Invoice }
amount: { Field: Read.Amount }
- DeliverResults: HandOver
- ModelCall: Reply
Instructions: Tell the billing system the refund was issued, and give its refund id.
Output: ContentBefore you upload itReplace the
mcp:// locator with your billing tool server’s connection id and tool name. An upload whose locator matches no registered tool is refused.