Generate handler code
generate_handlerGenerates typed payload models, a fixture, and a test from a captured webhook, plus signature details, so you can build and verify a handler in TypeScript, Python, PHP, or Go.
Instructions
Turns a real captured webhook into code to build a handler around: typed models of its payload, a fixture file with the body, and a test that posts it to the handler. Languages: typescript (types + Jest/Vitest test), python (dataclasses + pytest), php (DTO + Laravel test), go (structs; no test). Returns file contents with suggested names; it writes nothing, so save them with your own file tools. Also says which signature scheme the endpoint checks, so the handler can verify it.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"event_id": "<event_id>",
"language": "<language>"
},
"name": "generate_handler"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parts | No | Which files to generate. Default: all three | |
| event_id | Yes | Which event: its number (12 or "#12", from list_events or the dashboard), "latest", "latest <event type>" such as "latest invoice.paid", or the provider's own event id such as evt_1Qx... | |
| language | Yes | Language of the handler | |
| target_url | No | The handler URL the test posts to. Default: the endpoint's relay URL, or http://localhost:3000/webhooks |