Skip to main content
Glama

get_note

Retrieve the full content of a HackMD note by providing its unique note ID. Access stored note details quickly.

Instructions

Get a note by ID (returns full content)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_idYesNote ID

Implementation Reference

  • Tool 'get_note' registration and handler: fetches a note by ID from the HackMD API via a GET request to /notes/{note_id}. Input schema validates a required note_id string.
    server.tool(
      "get_note",
      "Get a note by ID (returns full content)",
      {
        note_id: z.string().min(1).describe("Note ID"),
      },
      async ({ note_id }) => {
        try {
          return success(await hackmdFetch(`/notes/${note_id}`));
        } catch (e) {
          return error((e as Error).message);
        }
      }
    );
  • Zod schema for 'get_note' input: requires note_id as a non-empty string.
    server.tool(
      "get_note",
      "Get a note by ID (returns full content)",
      {
        note_id: z.string().min(1).describe("Note ID"),
      },
  • src/tools.ts:6-6 (registration)
    The registerTools function is called from server.ts to register all tools including get_note with the MCP server.
    export function registerTools(server: McpServer) {
  • hackmdFetch helper: makes authenticated HTTP requests to the HackMD API, used by get_note to GET /notes/{note_id}.
    export async function hackmdFetch(
      path: string,
      options: { method?: string; body?: unknown } = {}
    ): Promise<unknown> {
      const { method = "GET", body } = options;
      const token = getToken();
    
      const res = await fetch(`${API_BASE}${path}`, {
        method,
        headers: {
          Authorization: `Bearer ${token}`,
          ...(body ? { "Content-Type": "application/json" } : {}),
        },
        ...(body ? { body: JSON.stringify(body) } : {}),
      });
    
      if (!res.ok) {
        const text = await res.text().catch(() => "");
        throw new Error(`HackMD API ${method} ${path} → ${res.status}: ${text}`);
      }
    
      if (res.status === 204) return { success: true };
      if (res.status === 202) return { success: true, status: "accepted" };
    
      return res.json();
    }
  • success and error response formatters: wrap API results into MCP-compatible content arrays, used by the get_note handler's return value.
    export function success(data: unknown) {
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
    
    export function error(message: string) {
      return {
        content: [{ type: "text" as const, text: JSON.stringify({ error: message }) }],
        isError: true as const,
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the full burden. It indicates a read operation and full content return, but lacks details on error handling, permissions, or any side effects. Adequate for a simple get, but could be more transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence with no wasted words. It is front-loaded and directly conveys the tool's purpose succinctly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given low complexity (1 param, no output schema), the description is largely complete. However, noting the lack of return field details, it could mention what 'full content' entails. Still, it sufficiently informs the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with one parameter 'note_id' described as 'Note ID'. The description adds 'by ID' but does not provide additional context like format or constraints beyond the schema. Baseline score applies as schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb ('Get') and resource ('a note by ID'), and adds 'returns full content' which differentiates it from siblings like list_notes or delete_note.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives (e.g., list_notes). Usage is implied by the name and description, but no when-not or alternative tools are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/zyx1121/hackmd-mcp'

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