newNote
Create and save notes in Flomo directly through AI chat interactions using natural language commands. Capture thoughts and information by typing your note content.
Instructions
Create a new note in Flomo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes |
Implementation Reference
- index.ts:47-67 (handler)Inline asynchronous handler function for the 'newNote' tool. It calls createFlomoNote with the input value and returns the JSON-stringified response or error as MCP-formatted content.async (input) => { try { const response = await createFlomoNote(input.input); return { content: [ { type: "text", text: `${JSON.stringify(response)}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `${JSON.stringify(error)}`, }, ], }; }
- index.ts:14-28 (schema)TypeScript interface defining the structure of the response from the Flomo API when creating a new note.interface FlomoNewNoteResponse { code: number; message: string; memo: { creator_id: number; source: string; content: string; tags: string[]; updated_at: string; created_at: string; linked_memos: any[]; linked_count: number; slug: string; }; }
- index.ts:43-69 (registration)Registration of the 'newNote' tool on the MCP server, including name, description, Zod input schema, and handler function.server.tool( "newNote", "Create a new note in Flomo", { input: z.string() }, async (input) => { try { const response = await createFlomoNote(input.input); return { content: [ { type: "text", text: `${JSON.stringify(response)}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `${JSON.stringify(error)}`, }, ], }; } } );
- index.ts:70-81 (helper)Helper function that sends a POST request to the Flomo API to create a new note with the provided content.async function createFlomoNote(content: string): Promise<FlomoNewNoteResponse> { const body = { content: content, }; return await fetch(flomoApiUrl, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(body), }).then((res) => res.json()); }