get_note
Retrieve a specific note by its ID using the HackMD MCP Server, enabling AI assistants to access and manage note content directly via the HackMD API.
Instructions
Get a note by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | Note ID |
Implementation Reference
- tools/userNotes.ts:52-69 (handler)The handler function for the 'get_note' tool. It takes a noteId, fetches the note using the HackMD API client, and returns the note as JSON or an error message.async ({ noteId }) => { try { const note = await client.getNote(noteId); return { content: [ { type: "text", text: JSON.stringify(note, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } },
- tools/userNotes.ts:44-46 (schema)The input schema for the 'get_note' tool, requiring a 'noteId' string parameter.{ noteId: z.string().describe("Note ID"), },
- tools/userNotes.ts:41-70 (registration)The registration of the 'get_note' tool using server.tool(), including name, description, input schema, metadata hints, and handler function.server.tool( "get_note", "Get a note by its ID", { noteId: z.string().describe("Note ID"), }, { title: "Get a note", readOnlyHint: true, openWorldHint: true, }, async ({ noteId }) => { try { const note = await client.getNote(noteId); return { content: [ { type: "text", text: JSON.stringify(note, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, );
- tools/index.ts:21-21 (registration)Invocation of registerUserNotesApiTools within registerAllTools, which registers the 'get_note' tool (among others) to the MCP server.registerUserNotesApiTools(server, client);