deleteEvent
Remove events from the Nostr network by publishing deletion notices to relays, specifying event IDs and optional reason.
Instructions
Delete events (kind 5)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventIds | Yes | IDs of events to delete | |
| reason | No | Reason for deletion | |
| privateKey | No | Private key (nsec or hex). Optional when NOSTR_BUNKER_URI is configured. | |
| relays | No | Relays to publish to |
Implementation Reference
- src/tools/social-tools.ts:143-155 (handler)The implementation of the deleteEvent tool. It creates a delete event (kind 5) with the provided event IDs and signs/publishes it.
export async function deleteEvent({ eventIds, reason, privateKey, relays }: z.infer<typeof deleteEventSchema>) { const tags: string[][] = eventIds.map(id => ['e', id]); const template: EventTemplate = { kind: KINDS.DELETE, content: reason ?? '', tags, created_at: Math.floor(Date.now() / 1000), }; const signed = await signTemplate(template, privateKey); const result = await publishEvent(signed, relays ?? DEFAULT_RELAYS); return { event: signed, published: result }; } - src/tools/social-tools.ts:37-42 (schema)Zod schema definition for validating the input parameters for the deleteEvent tool.
export const deleteEventSchema = z.object({ eventIds: z.array(z.string()).describe('IDs of events to delete'), reason: z.string().optional().describe('Reason for deletion'), privateKey: z.string().optional().describe(privateKeyDesc), relays: z.array(z.string()).optional().describe('Relays to publish to'), });