Skip to main content
Glama
kesslerio

Attio MCP Server

by kesslerio

get-record-list-memberships

Find all CRM lists that contain a specific record (company or person) to understand its groupings and relationships within Attio CRM.

Instructions

Find all CRM lists that a specific record (company, person, etc.) belongs to

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
batchSizeNoNumber of lists to process in parallel (1-20, default: 5)
includeEntryValuesNoWhether to include entry values in the response (e.g., stage, status)
objectTypeNoType of record (e.g., "companies", "people")
recordIdYesID of the record to find in lists

Implementation Reference

  • Core implementation of the get-record-list-memberships tool. Queries Attio API endpoints for list entries associated with the given record ID across companies, people, and deals objects. Handles validation, batching, and error recovery.
    export async function getRecordListMemberships(
      recordId: string,
      objectType?: string,
      includeEntryValues: boolean = false,
      batchSize: number = 5
    ): Promise<ListMembership[]> {
      if (!recordId || typeof recordId !== 'string' || !isValidUUID(recordId)) {
        return [];
      }
    
      if (
        objectType &&
        !Object.values(ResourceType).includes(objectType as ResourceType)
      ) {
        const validTypes = Object.values(ResourceType).join(', ');
        throw new Error(
          `Invalid object type: "${objectType}". Must be one of: ${validTypes}`
        );
      }
    
      try {
        const api = getLazyAttioClient();
        const memberships: ListMembership[] = [];
    
        const objectTypes = objectType
          ? [objectType]
          : ['companies', 'people', 'deals'];
        const maxTypes = Math.max(1, batchSize);
        const typesToQuery = objectTypes.slice(0, maxTypes);
    
        for (const objType of typesToQuery) {
          try {
            const response = await api.get(
              `/objects/${objType}/records/${recordId}/entries`
            );
            const rawEntries = Array.isArray(response?.data?.data)
              ? (response.data.data as Array<Record<string, unknown>>)
              : [];
    
            for (const entry of rawEntries) {
              const listId =
                (entry.list_id as string | undefined) ||
                (
                  (entry.list as Record<string, unknown> | undefined)?.id as
                    | { list_id?: string }
                    | undefined
                )?.list_id ||
                'unknown';
              const listName =
                ((entry.list as Record<string, unknown> | undefined)?.name as
                  | string
                  | undefined) || 'Unknown List';
              const entryIdValue = entry.id as
                | string
                | { entry_id?: string }
                | undefined;
              const entryId =
                typeof entryIdValue === 'string'
                  ? entryIdValue
                  : (entryIdValue?.entry_id ?? 'unknown');
    
              memberships.push({
                listId,
                listName,
                entryId,
                entryValues: includeEntryValues
                  ? ((entry.values as ListEntryValues | undefined) ?? {})
                  : undefined,
              });
            }
    
            if (objectType) {
              break;
            }
          } catch (error: unknown) {
            if (isNotFoundError(error)) {
              continue;
            }
            if (process.env.NODE_ENV === 'development') {
              createScopedLogger('lists', 'getRecordListMemberships').warn(
                `Error checking ${objType} entries for record ${recordId}`,
                { error: getErrorMessage(error) ?? String(error) }
              );
            }
          }
        }
    
        return memberships;
      } catch (error: unknown) {
        if (isNotFoundError(error)) {
          return [];
        }
        if (process.env.NODE_ENV === 'development') {
          createScopedLogger('lists', 'getRecordListMemberships').warn(
            `Error in getRecordListMemberships for record ${recordId}`,
            { error: getErrorMessage(error) ?? String(error) }
          );
        }
        return [];
      }
    }
  • Tool configuration registering the handler function, name, and result formatter for the get-record-list-memberships tool.
    getRecordListMemberships: {
      name: 'get-record-list-memberships',
      handler: getRecordListMemberships,
      formatResult: (results: ListMembership[] | null | undefined) => {
        // Return JSON string - dispatcher will convert to JSON content
        return JSON.stringify(Array.isArray(results) ? results : []);
      },
    } as ToolConfig,
  • Input schema and description definition for the get-record-list-memberships tool, including parameters like recordId, objectType, includeEntryValues, and batchSize.
      name: 'get-record-list-memberships',
      description: formatToolDescription({
        capability:
          'Find all lists containing a specific company or person record.',
        boundaries: 'modify list memberships or retrieve list entries.',
        constraints:
          'Requires recordId; processes 5 lists in parallel by default (max 20).',
        recoveryHint:
          'If record not found, verify recordId with records_search first.',
      }),
      inputSchema: {
        type: 'object',
        properties: {
          recordId: {
            type: 'string',
            description: 'ID of the record to find in lists',
            example: '550e8400-e29b-41d4-a716-446655440000',
          },
          objectType: {
            type: 'string',
            description: 'Type of record (e.g., "companies", "people")',
            enum: ['companies', 'people'],
          },
          includeEntryValues: {
            type: 'boolean',
            description:
              'Whether to include entry values in the response (e.g., stage, status)',
            default: false,
          },
          batchSize: {
            type: 'number',
            description:
              'Number of lists to process in parallel (1-20, default: 5)',
            minimum: 1,
            maximum: 20,
            default: 5,
          },
        },
        required: ['recordId'],
        additionalProperties: false,
      },
    },
  • Central tool registry where listsToolConfigs (including get-record-list-memberships) is registered under ResourceType.LISTS for both universal and legacy modes.
    export const TOOL_CONFIGS = USE_UNIVERSAL_TOOLS_ONLY
      ? {
          // Universal tools for consolidated operations (Issue #352)
          UNIVERSAL: universalToolConfigs,
          // Lists are relationship containers - always expose them (Issue #470)
          [ResourceType.LISTS]: listsToolConfigs,
          // Workspace members for user discovery (Issue #684)
          [ResourceType.WORKSPACE_MEMBERS]: workspaceMembersToolConfigs,
        }
      : {
          // Legacy resource-specific tools (deprecated, use DISABLE_UNIVERSAL_TOOLS=true to enable)
          [ResourceType.COMPANIES]: companyToolConfigs,
          [ResourceType.PEOPLE]: peopleToolConfigs,
          [ResourceType.DEALS]: dealToolConfigs,
          [ResourceType.LISTS]: listsToolConfigs,
          [ResourceType.TASKS]: tasksToolConfigs,
          [ResourceType.RECORDS]: recordToolConfigs,
          [ResourceType.WORKSPACE_MEMBERS]: workspaceMembersToolConfigs,
          GENERAL: generalToolConfigs,
          // Add other resource types as needed
        };
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 of behavioral disclosure. It states the tool 'finds' lists, implying a read-only operation, but does not disclose other traits such as rate limits, authentication needs, pagination behavior, or what happens if the record doesn't exist. This is a significant gap for a tool with no annotation coverage.

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?

The description is a single, efficient sentence that front-loads the core purpose ('Find all CRM lists that a specific record belongs to') with no wasted words. Every part of the sentence earns its place by specifying the action, scope, and target.

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?

Given no annotations and no output schema, the description is adequate for a read operation but incomplete. It covers the basic purpose and parameters (via schema), but lacks details on behavioral traits (e.g., error handling, performance) and output format, which are important for a tool with 4 parameters and no structured output documentation.

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 description coverage is 100%, so the schema already documents all parameters thoroughly. The description does not add meaning beyond the schema (e.g., it doesn't explain how 'objectType' and 'recordId' interact or what 'includeEntryValues' entails in practice). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Find') and resource ('all CRM lists that a specific record belongs to'), and it distinguishes from siblings like 'get-list-details' (which lists list properties) or 'get-list-entries' (which lists entries within a list) by focusing on membership relationships for a given record.

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 need to know which lists contain a particular record, but it does not explicitly state when to use this tool versus alternatives (e.g., 'filter-list-entries' for filtering entries within a list, or 'search' for broader searches). No exclusions or prerequisites are mentioned.

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/kesslerio/attio-mcp-server'

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