write_note
Create and save markdown-formatted notes directly to Flomo using this tool. Ideal for quick text input and organization through the MCP Server Flomo interface.
Instructions
Write note to flomo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Text content of the note with markdown format |
Implementation Reference
- src/index.ts:76-101 (handler)MCP handler for the 'write_note' tool: validates content, instantiates FlomoClient, calls writeNote, checks result, and returns formatted success response.case "write_note": { const content = String(request.params.arguments?.content); if (!content) { throw new Error("Content is required"); } const flomo = new FlomoClient({ apiUrl }); const result = await flomo.writeNote({ content }); if (!result.memo || !result.memo.slug) { throw new Error( `Failed to write note to flomo: ${result?.message || "unknown error"}` ); } return { content: [ { type: "text", text: `Write note to flomo success, result: ${JSON.stringify( result )}`, }, ], }; }
- src/index.ts:48-60 (schema)Input schema for the 'write_note' tool, defining the required 'content' string property.name: "write_note", description: "Write note to flomo", inputSchema: { type: "object", properties: { content: { type: "string", description: "Text content of the note with markdown format", }, }, required: ["content"], }, },
- src/index.ts:44-63 (registration)Registers the 'write_note' tool in response to ListToolsRequest by returning its specification.server.setRequestHandler(ListToolsRequestSchema, async (request) => { return { tools: [ { name: "write_note", description: "Write note to flomo", inputSchema: { type: "object", properties: { content: { type: "string", description: "Text content of the note with markdown format", }, }, required: ["content"], }, }, ], }; });
- src/flomo.ts:20-53 (helper)Helper function in FlomoClient that performs the actual POST request to the Flomo API to create a note and enhances the response with a memo URL.async writeNote({ content }: { content: string }) { try { if (!content) { throw new Error("invalid content"); } const req = { content, }; const resp = await fetch(this.apiUrl, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(req), }); if (!resp.ok) { throw new Error(`request failed with status ${resp.statusText}`); } let result = await resp.json(); if (result && result.memo && result.memo.slug) { const memoUrl = `https://v.flomoapp.com/mine/?memo_id=${result.memo.slug}`; result.memo.url = memoUrl; } return result; } catch (e) { throw e; } }