Skip to main content
Glama

list_teams

List all teams the authenticated user belongs to. Use this to view team memberships and access team-specific notes.

Instructions

List teams the user belongs to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'list_teams' tool. It calls hackmdFetch('/teams') to list teams the user belongs to, and returns the result wrapped with success() or error().
    server.tool("list_teams", "List teams the user belongs to", {}, async () => {
      try {
        return success(await hackmdFetch("/teams"));
      } catch (e) {
        return error((e as Error).message);
      }
    });
  • src/tools.ts:138-144 (registration)
    Registration of the 'list_teams' tool via server.tool() with name, description, empty input schema ({}), and async handler.
    server.tool("list_teams", "List teams the user belongs to", {}, async () => {
      try {
        return success(await hackmdFetch("/teams"));
      } catch (e) {
        return error((e as Error).message);
      }
    });
  • The empty Zod schema {} is used as the input validation for list_teams, meaning no parameters are required.
    server.tool("list_teams", "List teams the user belongs to", {}, async () => {
      try {
        return success(await hackmdFetch("/teams"));
      } catch (e) {
        return error((e as Error).message);
      }
    });
  • The hackmdFetch helper function that performs authenticated HTTP requests to the HackMD API. Called by the list_teams handler with path '/teams'.
    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" };
  • The success() and error() helper functions used to format MCP tool responses. success serializes data as JSON, error returns an isError response.
    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?

With no annotations, the description bears full responsibility for behavioral disclosure. It only states 'List teams the user belongs to,' omitting details like read-only nature, return format, or any side effects.

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 very concise at one sentence, but it is appropriately sized for a simple tool with no parameters. No wasted words.

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 lack of output schema, the description should explain what the tool returns (e.g., team IDs, names). It fails to do so, leaving the agent uncertain about the result structure.

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

Parameters4/5

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

The tool has zero parameters, so baseline is 4. The description does not need to add parameter information, and it correctly implies no input is required.

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 ('list') and the resource ('teams'), and indicates a scope ('the user belongs to'). While it distinguishes from sibling tools which are mostly about notes, it doesn't explicitly differentiate from other list operations.

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 list_notes or get_me. The description is too minimal to convey usage context.

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