Skip to main content
Glama

repostEvent

Share existing Nostr events to your network by creating reposts, enabling content distribution across the decentralized social protocol.

Instructions

Repost an event (kind 6)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventIdYesID of the event to repost
eventPubkeyYesPubkey of the event author
relayUrlNoRelay URL where the original event lives
privateKeyNoPrivate key (nsec or hex). Optional when NOSTR_BUNKER_URI is configured.
relaysNoRelays to publish to

Implementation Reference

  • The handler implementation for reposting an event in Nostr (kind 6).
    export async function repostEvent({ eventId, eventPubkey, relayUrl, privateKey, relays }: z.infer<typeof repostEventSchema>) {
      const eTag = relayUrl ? ['e', eventId, relayUrl] : ['e', eventId];
      const template: EventTemplate = {
        kind: KINDS.REPOST,
        content: '',
        tags: [eTag, ['p', normalizePubkey(eventPubkey)]],
        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 input validation of the repostEvent tool.
    export const repostEventSchema = z.object({
      eventId: z.string().describe('ID of the event to repost'),
      eventPubkey: z.string().describe('Pubkey of the event author'),
      relayUrl: z.string().optional().describe('Relay URL where the original event lives'),
      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