Skip to main content
Glama

deleteEvent

Remove Nostr events by publishing deletion notices to relays, allowing users to delete specific event IDs with optional reasons.

Instructions

Delete events (kind 5)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventIdsYesIDs of events to delete
reasonNoReason for deletion
privateKeyNoPrivate key (nsec or hex). Optional when NOSTR_BUNKER_URI is configured.
relaysNoRelays to publish to

Implementation Reference

  • The handler function that creates and publishes a NIP-09 deletion event.
    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 };
    }
  • Zod schema for validating the deleteEvent input parameters.
    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'),
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jorgenclaw/nostr-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server