Skip to main content
Glama

update_note

Update an existing note on HackMD by changing its content, read or write permissions, or permalink to control access and sharing.

Instructions

Update a note's content or permissions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
note_idYesNote ID
contentNoNew markdown content
read_permissionNoRead permission
write_permissionNoWrite permission
permalinkNoCustom permalink

Implementation Reference

  • Handler for the 'update_note' tool. Defines input schema (note_id, content, read_permission, write_permission, permalink) and executes a PATCH request to /notes/:note_id via hackmdFetch to update a note's content or permissions.
    server.tool(
      "update_note",
      "Update a note's content or permissions",
      {
        note_id: z.string().min(1).describe("Note ID"),
        content: z.string().optional().describe("New markdown content"),
        read_permission: z
          .enum(["owner", "signed_in", "guest"])
          .optional()
          .describe("Read permission"),
        write_permission: z
          .enum(["owner", "signed_in", "guest"])
          .optional()
          .describe("Write permission"),
        permalink: z.string().optional().describe("Custom permalink"),
      },
      async ({ note_id, content, read_permission, write_permission, permalink }) => {
        try {
          const body: Record<string, unknown> = {};
          if (content !== undefined) body.content = content;
          if (read_permission !== undefined) body.readPermission = read_permission;
          if (write_permission !== undefined) body.writePermission = write_permission;
          if (permalink !== undefined) body.permalink = permalink;
    
          return success(await hackmdFetch(`/notes/${note_id}`, { method: "PATCH", body }));
        } catch (e) {
          return error((e as Error).message);
        }
      }
    );
  • src/tools.ts:80-109 (registration)
    The 'update_note' tool is registered via server.tool() with its name, description, Zod schema, and async handler function, all in one call.
    server.tool(
      "update_note",
      "Update a note's content or permissions",
      {
        note_id: z.string().min(1).describe("Note ID"),
        content: z.string().optional().describe("New markdown content"),
        read_permission: z
          .enum(["owner", "signed_in", "guest"])
          .optional()
          .describe("Read permission"),
        write_permission: z
          .enum(["owner", "signed_in", "guest"])
          .optional()
          .describe("Write permission"),
        permalink: z.string().optional().describe("Custom permalink"),
      },
      async ({ note_id, content, read_permission, write_permission, permalink }) => {
        try {
          const body: Record<string, unknown> = {};
          if (content !== undefined) body.content = content;
          if (read_permission !== undefined) body.readPermission = read_permission;
          if (write_permission !== undefined) body.writePermission = write_permission;
          if (permalink !== undefined) body.permalink = permalink;
    
          return success(await hackmdFetch(`/notes/${note_id}`, { method: "PATCH", body }));
        } catch (e) {
          return error((e as Error).message);
        }
      }
    );
Behavior2/5

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

No annotations provided; description only says 'update' without mentioning idempotency, effect on omitted fields, or response. Insufficient for mutation tool.

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

Conciseness3/5

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

Single sentence is concise but lacks structure. Could front-load key behavioral info or constraints.

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

Completeness2/5

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

No output schema, missing details on permission values' implications, and no context on update behavior for partial input. Incomplete for agent use.

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 covers all 5 parameters with descriptions (100% coverage), so baseline 3. Description adds only broad categorization; no additional nuance.

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?

Description clearly states the action (Update) and resource (note) with specific modifications (content or permissions). Distinct from sibling create/delete tools.

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

Usage Guidelines2/5

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

No guidance on when to use this vs siblings like update_team_note, no prerequisites, no context for invocation.

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