Skip to main content
Glama

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
NameRequiredDescriptionDefault
noteIdYesNote ID

Implementation Reference

  • 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,
        };
      }
    },
  • The input schema for the 'get_note' tool, requiring a 'noteId' string parameter.
    {
      noteId: z.string().describe("Note ID"),
    },
  • 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);
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yuna0x0/hackmd-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server