Skip to main content
Glama
ZLeventer

hubspot-mcp

hs_list_lists

Retrieve all HubSpot contact lists, including static and active lists, with optional filtering by name substring to find specific lists quickly.

Instructions

List all HubSpot contact lists (static and active). Optionally filter by name substring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryNoFilter by list name substring

Implementation Reference

  • The actual handler function that executes the 'hs_list_lists' tool logic. It calls HubSpot GET /contacts/v1/lists with optional 'count' and 'query' parameters.
    export async function listLists(args: z.infer<typeof ListListsSchema>) {
      const params: Record<string, string | number | boolean> = {
        count: args.limit ?? 50,
        offset: 0,
      };
      if (args.query) params.query = args.query;
      return hubspot("/contacts/v1/lists", "GET", undefined, params);
    }
  • Zod schema defining input validation for hs_list_lists: limit (number, 1-500, default 50, optional) and query (optional string for name filter).
    export const ListListsSchema = z.object({
      limit: z.number().int().min(1).max(500).default(50).optional(),
      query: z.string().optional().describe("Filter by list name substring"),
    });
  • src/index.ts:195-200 (registration)
    Registration of the 'hs_list_lists' tool with the MCP server via server.tool(), binding the schema and handler.
    server.tool(
      "hs_list_lists",
      "List all HubSpot contact lists (static and active). Optionally filter by name substring.",
      ListListsSchema.shape,
      async (args) => { try { return ok(await listLists(args)); } catch (e) { return err(e); } },
    );
  • src/index.ts:37-42 (registration)
    Import of ListListsSchema and listLists from src/tools/lists.ts into the main index file.
    // Lists
    import {
      ListListsSchema, listLists,
      GetListSchema, getList,
      ListMembersSchema, listMembers,
    } from "./tools/lists.js";
  • The hubspot() helper function that executes the actual HTTP request to the HubSpot API, used by the listLists handler.
    export async function hubspot<T = unknown>(
      path: string,
      method: "GET" | "POST" | "PATCH" | "DELETE" = "GET",
      body?: unknown,
      params?: Record<string, string | number | boolean>,
    ): Promise<T> {
      const token = getToken();
    
      let url = `${BASE_URL}${path}`;
      if (params && method === "GET") {
        const qs = new URLSearchParams(
          Object.entries(params).map(([k, v]) => [k, String(v)]),
        ).toString();
        if (qs) url += `?${qs}`;
      }
    
      const res = await fetch(url, {
        method,
        headers: {
          Authorization: `Bearer ${token}`,
          "Content-Type": "application/json",
        },
        ...(body && method !== "GET" ? { body: JSON.stringify(body) } : {}),
      });
    
      if (!res.ok) {
        const text = await res.text().catch(() => res.statusText);
        throw new HubSpotError(`HubSpot API error (${res.status}): ${text}`, res.status);
      }
    
      if (res.status === 204) return undefined as T;
      return (await res.json()) as T;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions listing all lists but does not disclose behavioral traits such as read-only nature, rate limits, authentication requirements, or what happens with no results. For a listing tool, this is insufficient.

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

Conciseness5/5

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

Two short sentences with no redundancy. The core purpose is front-loaded, and every word adds value. Highly efficient.

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

Completeness3/5

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

The description covers the basic operation but lacks details on return format, pagination behavior, and limit semantics. Since there is no output schema, the description should compensate but fails to describe the response structure, making it incomplete for an agent to fully understand the output.

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 coverage is 50% (query has description, limit does not). The description adds a phrase 'Optionally filter by name substring' which reinforces the query parameter but adds no new meaning beyond the schema. The limit parameter is not described, leaving the agent unclear about its effect.

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 it lists all HubSpot contact lists (static and active) with optional name filtering. The verb 'list' and resource 'HubSpot contact lists' are specific. However, it does not explicitly differentiate from sibling tools like 'hs_get_list' (single list) or 'hs_crm_search', though the tool name suggests plural.

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

Usage Guidelines3/5

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

The description implies usage when you want to retrieve all contact lists, but no explicit guidance on when not to use this tool or alternatives. Siblings like 'hs_get_list' exist for single list retrieval, but no reference is made.

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/ZLeventer/hubspot-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server