hs_get_list
Retrieve membership count and list type for a specific HubSpot contact list using its list ID.
Instructions
Get metadata for a specific contact list including membership count and list type.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | HubSpot contact list ID |
Implementation Reference
- src/index.ts:37-42 (registration)Import of GetListSchema and getList from src/tools/lists.ts, used in tool registration.
// Lists import { ListListsSchema, listLists, GetListSchema, getList, ListMembersSchema, listMembers, } from "./tools/lists.js"; - src/index.ts:202-207 (registration)Registration of the 'hs_get_list' tool with the MCP server, linking the schema (GetListSchema.shape) to the handler (getList).
server.tool( "hs_get_list", "Get metadata for a specific contact list including membership count and list type.", GetListSchema.shape, async (args) => { try { return ok(await getList(args)); } catch (e) { return err(e); } }, ); - src/tools/lists.ts:18-20 (schema)Zod schema for hs_get_list input validation – requires a single parameter 'listId' (number).
export const GetListSchema = z.object({ listId: z.number().int().describe("HubSpot contact list ID"), }); - src/tools/lists.ts:22-24 (handler)Handler function that executes the tool logic: calls the HubSpot API endpoint /contacts/v1/lists/{listId} to get list metadata.
export async function getList(args: z.infer<typeof GetListSchema>) { return hubspot(`/contacts/v1/lists/${args.listId}`); }