refund
Process refunds for completed payments using correlation IDs to reverse transactions through the Junto MCP server's multi-provider payment system.
Instructions
Refund a completed payment by correlation ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Correlation ID of the payment to refund | |
| provider | No | Provider that handled the transaction |
Implementation Reference
- src/index.ts:344-375 (handler)The handler for the 'refund' MCP tool, which calls the selected provider's refund method and performs auditing.
server.tool( "refund", "Refund a completed payment by correlation ID.", RefundSchema.shape, async (params) => { try { const provider = pickProvider(undefined, undefined, params.provider); const result = await provider.refund(params.id); guardrails.audit({ timestamp: new Date().toISOString(), type: "payment", action: "refund", tool: "refund", provider: provider.name, status: "executed", }); return jsonResult(result); } catch (err) { guardrails.audit({ timestamp: new Date().toISOString(), type: "payment", action: "refund", tool: "refund", status: "failed", reason: formatError(err), }); return textResult(`Refund failed: ${formatError(err)}`); } } ); - src/index.ts:167-170 (schema)The schema definition for the 'refund' tool, requiring an ID and optional provider.
const RefundSchema = z.object({ id: z.string().describe("Correlation ID of the payment to refund"), provider: z.string().optional().describe("Provider that handled the transaction"), });