Skip to main content
Glama

create_note

Create a new HackMD note with customizable read, write, and comment permissions, optional custom permalink, and markdown content.

Instructions

Create a new note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNoNote title
contentNoMarkdown content
read_permissionNoRead permission (default: guest)guest
write_permissionNoWrite permission (default: owner)owner
comment_permissionNoComment permission
permalinkNoCustom permalink

Implementation Reference

  • Handler function for 'create_note' tool — builds request body with optional title, content, permissions, and permalink, then POSTs to /notes via hackmdFetch. Also includes Zod schema validation.
    server.tool(
      "create_note",
      "Create a new note",
      {
        title: z.string().optional().describe("Note title"),
        content: z.string().optional().describe("Markdown content"),
        read_permission: z
          .enum(["owner", "signed_in", "guest"])
          .default("guest")
          .describe("Read permission (default: guest)"),
        write_permission: z
          .enum(["owner", "signed_in", "guest"])
          .default("owner")
          .describe("Write permission (default: owner)"),
        comment_permission: z
          .enum(["disabled", "forbidden", "owners", "signed_in_users", "everyone"])
          .optional()
          .describe("Comment permission"),
        permalink: z.string().optional().describe("Custom permalink"),
      },
      async ({ title, content, read_permission, write_permission, comment_permission, permalink }) => {
        try {
          const body: Record<string, unknown> = {
            readPermission: read_permission,
            writePermission: write_permission,
          };
          if (title !== undefined) body.title = title;
          if (content !== undefined) body.content = content;
          if (comment_permission !== undefined) body.commentPermission = comment_permission;
          if (permalink !== undefined) body.permalink = permalink;
    
          return success(await hackmdFetch("/notes", { method: "POST", body }));
        } catch (e) {
          return error((e as Error).message);
        }
      }
    );
  • Zod schema definition for 'create_note' input parameters: title, content, read_permission, write_permission, comment_permission, permalink.
    server.tool(
      "create_note",
      "Create a new note",
      {
        title: z.string().optional().describe("Note title"),
        content: z.string().optional().describe("Markdown content"),
        read_permission: z
          .enum(["owner", "signed_in", "guest"])
          .default("guest")
          .describe("Read permission (default: guest)"),
        write_permission: z
          .enum(["owner", "signed_in", "guest"])
          .default("owner")
          .describe("Write permission (default: owner)"),
        comment_permission: z
          .enum(["disabled", "forbidden", "owners", "signed_in_users", "everyone"])
          .optional()
          .describe("Comment permission"),
        permalink: z.string().optional().describe("Custom permalink"),
      },
  • src/tools.ts:6-6 (registration)
    The registerTools function registers all tools including 'create_note' on the MCP server instance.
    export function registerTools(server: McpServer) {
  • hackmdFetch helper used by create_note to make authenticated HTTP requests to the HackMD API.
    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() helper functions used to format MCP tool responses from create_note.
    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,
      };
    }
Behavior2/5

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

No annotations are present, and the description does not disclose any behavioral traits such as return values, side effects, or required permissions.

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?

The description is a single concise sentence, but it lacks structure such as bullet points or sections. It is not overly verbose, but could be more informative.

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?

Given the complexity (6 parameters, no output schema, no annotations), the description is incomplete, omitting important context like success behavior or error conditions.

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?

The input schema has 100% description coverage for all 6 parameters, so the schema does the heavy lifting. The description adds no additional parameter information, meeting the baseline.

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

Purpose4/5

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

The description clearly states the action ('Create') and the resource ('a new note'), but it does not differentiate from the sibling tool 'create_team_note', which has a similar purpose.

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 is provided on when to use this tool versus alternatives like 'create_team_note' or prerequisites for usage.

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