madeonsol_test_webhook
Test a webhook by sending a sample event payload and receiving its status code and response time.
Instructions
Send a sample event payload to a webhook URL to verify it works. Returns status code and response time.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| webhook_id | Yes | ID of the webhook to test |
Implementation Reference
- src/index.ts:519-521 (handler)Handler function for the madeonsol_test_webhook tool. Sends a POST request to /api/v1/webhooks/test with the webhook_id to trigger a test payload delivery to the registered webhook URL.
async ({ webhook_id }) => ({ content: [{ type: "text" as const, text: await restQuery("POST", "/webhooks/test", { webhook_id }) }], }) - src/index.ts:516-518 (schema)Schema for the madeonsol_test_webhook tool. Defines a single required parameter: webhook_id (number).
webhook_id: z.number().describe("ID of the webhook to test"), }, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, - src/index.ts:512-522 (registration)Registration of the madeonsol_test_webhook tool via server.tool(), including description, Zod schema, annotations, and handler. Conditionally registered only when authMode === 'madeonsol' (requires MadeOnSol API key).
server.tool( "madeonsol_test_webhook", "Send a sample event payload to a webhook URL to verify it works. Returns status code and response time.", { webhook_id: z.number().describe("ID of the webhook to test"), }, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, async ({ webhook_id }) => ({ content: [{ type: "text" as const, text: await restQuery("POST", "/webhooks/test", { webhook_id }) }], }) ); - src/index.ts:451-466 (helper)The restQuery helper function used by madeonsol_test_webhook's handler. It constructs a fetch request to the MadeOnSol API with JSON content-type and Bearer auth headers, handles errors, and returns the JSON response as a formatted string.
async function restQuery(method: string, path: string, body?: unknown): Promise<string> { const headers: Record<string, string> = { "Content-Type": "application/json", ...apiKeyHeaders(), }; const res = await fetch(`${BASE_URL}/api/v1${path}`, { method, headers, ...(body ? { body: JSON.stringify(body) } : {}), }); if (!res.ok) { const text = await res.text().catch(() => ""); return `Error ${res.status}: ${text}`; } return JSON.stringify(await res.json(), null, 2); }