publishNostrEvent
Publish signed events to Nostr relays for AI agents to broadcast content, replies, reactions, and reposts across the decentralized social network.
Instructions
Publish a signed event to relays
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| signedEvent | Yes | Signed event to publish | |
| relays | No | Relays to publish to |
Implementation Reference
- src/tools/event-tools.ts:65-67 (handler)The handler function that executes the publishNostrEvent tool logic by calling publishEvent with the signed event and target relays.
export async function publishNostrEvent({ signedEvent, relays }: z.infer<typeof publishNostrEventSchema>) { return publishEvent(signedEvent as any, relays ?? DEFAULT_RELAYS); } - src/tools/event-tools.ts:27-38 (schema)The Zod schema definition for the publishNostrEvent tool input, detailing the structure of the signed event and relay list.
export const publishNostrEventSchema = z.object({ signedEvent: z.object({ id: z.string(), kind: z.number(), content: z.string(), tags: z.array(z.array(z.string())), created_at: z.number(), pubkey: z.string(), sig: z.string(), }).describe('Signed event to publish'), relays: z.array(z.string()).optional().describe('Relays to publish to'), }); - src/index.ts:83-84 (registration)The registration of the publishNostrEvent tool within the MCP server setup in src/index.ts.
server.tool('publishNostrEvent', 'Publish a signed event to relays', publishNostrEventSchema.shape, async (params) => { return textResult(await publishNostrEvent(params));