createNote
Generate an unsigned Nostr text note (kind 1) using provided content and optional tags. Enables AI agents to prepare publishable notes without immediate signing, supporting flexible publishing workflows.
Instructions
Create an unsigned kind 1 text note
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Text content of the note | |
| tags | No | Event tags |
Implementation Reference
- src/tools/note-tools.ts:47-55 (handler)The handler function that creates an unsigned kind 1 text note event template. Takes content and optional tags, returns an EventTemplate with kind TEXT, current timestamp, and provided content/tags.
export function createNote({ content, tags }: z.infer<typeof createNoteSchema>) { const template: EventTemplate = { kind: KINDS.TEXT, content, tags: tags ?? [], created_at: Math.floor(Date.now() / 1000), }; return template; } - src/tools/note-tools.ts:11-14 (schema)Zod schema for createNote tool input validation. Defines 'content' (required string) and 'tags' (optional array of string arrays).
export const createNoteSchema = z.object({ content: z.string().describe('Text content of the note'), tags: z.array(z.array(z.string())).optional().describe('Event tags'), }); - src/index.ts:57-59 (registration)Registration of the 'createNote' tool on the MCP server with the name 'createNote', description 'Create an unsigned kind 1 text note', schema from createNoteSchema.shape, and handler that calls createNote and returns the result as text.
server.tool('createNote', 'Create an unsigned kind 1 text note', createNoteSchema.shape, async (params) => { return textResult(createNote(params)); }); - src/index.ts:51-53 (helper)Helper function used by the createNote handler to format the return value as a text content result for MCP.
function textResult(data: unknown) { return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }] }; }