Skip to main content
Glama

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
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 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 };
    }
  • 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'),
    });

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