repostEvent
Share existing Nostr events to your relays by creating reposts, enabling AI agents to amplify content across the decentralized social network.
Instructions
Repost an event (kind 6)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventId | Yes | ID of the event to repost | |
| eventPubkey | Yes | Pubkey of the event author | |
| relayUrl | No | Relay URL where the original event lives | |
| 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:129-141 (handler)The handler function that creates and publishes a repost event.
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 }; } - src/tools/social-tools.ts:29-35 (schema)The Zod schema defining the input parameters for repostEvent.
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'), });