list_team_notes
List all notes of a specified HackMD team by providing its path. Retrieve team note summaries for quick overview and management.
Instructions
List notes of a team
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| team_path | Yes | Team path (e.g. 'my-team') |
Implementation Reference
- src/tools.ts:146-159 (handler)The `list_team_notes` tool handler: registered with Zod schema for `team_path`, calls `hackmdFetch` to GET /teams/:team_path/notes
server.tool( "list_team_notes", "List notes of a team", { team_path: z.string().min(1).describe("Team path (e.g. 'my-team')"), }, async ({ team_path }) => { try { return success(await hackmdFetch(`/teams/${team_path}/notes`)); } catch (e) { return error((e as Error).message); } } ); - src/tools.ts:146-151 (schema)Zod input schema for `list_team_notes`: requires `team_path` (string, min 1)
server.tool( "list_team_notes", "List notes of a team", { team_path: z.string().min(1).describe("Team path (e.g. 'my-team')"), }, - src/tools.ts:146-159 (registration)Tool registered via `server.tool('list_team_notes', ...)` inside `registerTools()`
server.tool( "list_team_notes", "List notes of a team", { team_path: z.string().min(1).describe("Team path (e.g. 'my-team')"), }, async ({ team_path }) => { try { return success(await hackmdFetch(`/teams/${team_path}/notes`)); } catch (e) { return error((e as Error).message); } } ); - src/api.ts:13-38 (helper)`hackmdFetch` helper that performs 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(); } - src/helpers.ts:1-12 (helper)`success` and `error` response formatters used by the handler to return MCP-compatible results
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, }; }