Skip to main content
Glama

Generate handler code

generate_handler
Read-onlyIdempotent

Generates 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.

Input Schema

NameRequiredDescriptionDefault
partsNoWhich files to generate. Default: all three
event_idYesWhich 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...
languageYesLanguage of the handler
target_urlNoThe handler URL the test posts to. Default: the endpoint's relay URL, or http://localhost:3000/webhooks

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint and idempotentHint, but the description adds genuinely new behavior: it writes nothing to disk, returns file contents with suggested names, and requires the caller to persist them. Because there is no output schema, the note that the response is unsaved file contents plus a signature-scheme hint is the key information an agent needs before acting. It stops short of describing error behavior for a bad event_id.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core transformation, then deliverables, then language variants, then the no-side-effect caveat. Every sentence carries content, though the closing signature-scheme sentence is slightly bolted on and could be folded into the deliverables list.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and four parameters at full coverage, the description adequately covers what comes back (file contents with suggested names) and the critical constraint that nothing is written. Remaining gaps, such as failure modes on an unresolvable event_id or size limits on generated output, are minor for a read-only code generator.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so a 3 would be the floor, but the description goes further by explaining what each language actually yields (typescript with Jest/Vitest, python dataclasses with pytest, php DTO with Laravel test, go structs with no test). That per-value meaning is not derivable from the bare enum and directly affects the caller's choice.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('turns a real captured webhook into code') and immediately enumerates the concrete artifacts produced: typed models, a fixture file, and a test. The per-language breakdown makes it unmistakable against siblings like get_event, replay_event, or list_events, which deal in event data rather than generated code.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The context is clear: you use this after having a captured event, and the enum of languages signals the required inputs. It implicitly routes the agent to list_events for the event_id format. However, it never says when NOT to use it or names a sibling alternative explicitly, so it falls short of a full when/when-not treatment.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.