hyperd.watch.cancel
Cancel a watch you own to stop monitoring. Provide the watch ID; incurs a $0.001 USDC fee. Returns 404 if the watch does not exist or you are not the owner.
Instructions
Cancel a watch you own. $0.001 USDC ops fee covers the x402 auth path. Returns 404 (not 403) if the watch_id doesn't exist OR if you're not the owner — no existence-leak side-channel.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| watch_id | Yes | The watch_id returned from hyperd.watch.create. |
Implementation Reference
- src/server.ts:479-488 (registration)Registration of the hyperd.watch.cancel tool via server.tool(), with Zod schema for watch_id input and a handler that sends a DELETE to /api/watch/cancel.
// hyperd.watch.cancel — cancel an active watch ($0.001 ops fee) server.tool( "hyperd.watch.cancel", "Cancel a watch you own. $0.001 USDC ops fee covers the x402 auth path. Returns 404 (not 403) if the watch_id doesn't exist OR if you're not the owner — no existence-leak side-channel.", { watch_id: z.string().describe("The watch_id returned from hyperd.watch.create."), }, async (args) => asText(await paidWithBody("DELETE", "/api/watch/cancel", undefined, { watch_id: args.watch_id })), ); - src/server.ts:486-487 (handler)The inline handler function for hyperd.watch.cancel, which calls paidWithBody with DELETE method and passes watch_id as query parameter.
async (args) => asText(await paidWithBody("DELETE", "/api/watch/cancel", undefined, { watch_id: args.watch_id })), - src/server.ts:483-485 (schema)Zod input schema for hyperd.watch.cancel — accepts a single required string field 'watch_id'.
{ watch_id: z.string().describe("The watch_id returned from hyperd.watch.create."), }, - src/server.ts:98-112 (helper)Helper function paidWithBody used by the handler to make x402-authenticated requests with a body (DELETE/POST).
async function paidWithBody( method: "POST" | "DELETE", path: string, body: unknown, query: Record<string, string | number | boolean | undefined> = {}, ): Promise<unknown> { if (!httpClient) { throw new Error(WALLET_NOT_CONFIGURED_MSG); } const url = new URL(`${API_BASE}${path}`); for (const [k, v] of Object.entries(query)) { if (v !== undefined && v !== "" && v !== null) url.searchParams.set(k, String(v)); } return paidRequest(method, url, body); } - src/server.ts:155-157 (helper)Helper function asText that wraps JSON response into MCP text content format.
function asText(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }