Skip to main content
Glama

create_team_note

Create a new note in a HackMD team by specifying team path, title, markdown content, and read/write permissions. Optionally set a custom permalink for direct sharing.

Instructions

Create a note in a team

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
team_pathYesTeam path
titleNoNote title
contentNoMarkdown content
read_permissionNoRead permissionguest
write_permissionNoWrite permissionowner
permalinkNoCustom permalink

Implementation Reference

  • The tool 'create_team_note' is registered and implemented inline via server.tool(). It accepts team_path, title, content, read_permission, write_permission, and permalink parameters, builds a request body, and POSTs to /teams/:team_path/notes via hackmdFetch.
    server.tool(
      "create_team_note",
      "Create a note in a team",
      {
        team_path: z.string().min(1).describe("Team path"),
        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"),
        write_permission: z
          .enum(["owner", "signed_in", "guest"])
          .default("owner")
          .describe("Write permission"),
        permalink: z.string().optional().describe("Custom permalink"),
      },
      async ({ team_path, title, content, read_permission, write_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 (permalink !== undefined) body.permalink = permalink;
    
          return success(
            await hackmdFetch(`/teams/${team_path}/notes`, { method: "POST", body })
          );
        } catch (e) {
          return error((e as Error).message);
        }
      }
    );
  • Zod schema for 'create_team_note' defining the input shape: team_path (string), title (optional string), content (optional string), read_permission (enum), write_permission (enum), and permalink (optional string).
    server.tool(
      "create_team_note",
      "Create a note in a team",
      {
        team_path: z.string().min(1).describe("Team path"),
        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"),
        write_permission: z
          .enum(["owner", "signed_in", "guest"])
          .default("owner")
          .describe("Write permission"),
        permalink: z.string().optional().describe("Custom permalink"),
      },
  • src/tools.ts:161-195 (registration)
    Tool registration via server.tool() call within the registerTools function, binding the name, description, schema, and handler inline.
    server.tool(
      "create_team_note",
      "Create a note in a team",
      {
        team_path: z.string().min(1).describe("Team path"),
        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"),
        write_permission: z
          .enum(["owner", "signed_in", "guest"])
          .default("owner")
          .describe("Write permission"),
        permalink: z.string().optional().describe("Custom permalink"),
      },
      async ({ team_path, title, content, read_permission, write_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 (permalink !== undefined) body.permalink = permalink;
    
          return success(
            await hackmdFetch(`/teams/${team_path}/notes`, { method: "POST", body })
          );
        } catch (e) {
          return error((e as Error).message);
        }
      }
    );
  • hackmdFetch is the HTTP helper used by the handler to make authenticated API calls to the HackMD v1 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() helpers wrap responses in the MCP content format (text with JSON string).
    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 provided, so the description carries the full burden. The description only states the action without revealing behavioral traits such as permissions required, whether the note is immediately visible, or any side effects. The schema implies parameters but the description adds no behavioral context.

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

Conciseness4/5

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

The description is a single, concise sentence. It is front-loaded with the verb and resource. However, it is somewhat terse, lacking any elaboration on the parameters or usage context.

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?

Despite a well-documented schema, the description is too brief to be fully informative. It does not explain the output (no output schema exists), the relationship to teams, or the effect of parameters like permissions and permalink. The tool has six parameters and no annotations, so the description should provide more context.

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, so the schema already documents all parameters. The tool description adds no additional meaning beyond what is in the schema, meeting the baseline expectation.

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 specifies the verb 'Create' and the resource 'a note in a team', making the core action clear. However, it does not distinguish from the sibling tool 'create_note', which might create a personal note, so the purpose is not fully differentiated.

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?

The description provides no guidance on when to use this tool versus the sibling 'create_note' or 'delete_team_note'. There is no mention of prerequisites (e.g., user must have write access to the team) or context for when creation is appropriate.

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