discover-attributes
Find available attributes for Attio CRM resources including companies, people, lists, records, and tasks to understand data structure and available fields.
Instructions
Discover available attributes for any resource type
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| categories | No | Attribute categories | |
| resource_type | Yes | Type of resource to operate on (companies, people, lists, records, tasks) |
Implementation Reference
- Core handler function that fetches and formats attributes for a given resource_type by querying the Attio /v2/objects/{slug}/attributes API endpoint.export async function handleDiscoverAttributes( client: HttpClient, params: { resource_type: ResourceType; categories?: string[]; } ): Promise<ToolResult> { try { const { resource_type, categories } = params; const objectSlug = getObjectSlug(resource_type); const response = await client.get< AttioApiResponse< Array<{ api_slug: string; title: string; type: string; is_required: boolean; }> > >(`/v2/objects/${objectSlug}/attributes`); let attributes = response.data.data; // Filter by categories if provided if (categories && categories.length > 0) { // This is a simplified filter - the actual API might have different category handling attributes = attributes.filter((attr) => categories.some((cat) => attr.type?.toLowerCase().includes(cat.toLowerCase()) ) ); } if (attributes.length === 0) { return structuredResult([], `No attributes found for ${resource_type}`); } const lines = attributes.map((attr) => { const required = attr.is_required ? ' (required)' : ''; return `- ${attr.api_slug}: ${attr.type}${required} - ${attr.title}`; }); return structuredResult( attributes, `Attributes for ${resource_type}:\n${lines.join('\n')}` ); } catch (error) { const { message, details } = extractErrorInfo(error); return errorResult(message || 'Failed to discover attributes', details); } }
- JSON Schema and description definition for the records_discover_attributes tool, including input parameters and usage hints.export const discoverAttributesDefinition: ToolDefinition = { name: 'records_discover_attributes', description: formatDescription({ capability: 'Discover available attributes (standard/custom) for a resource, including their types', boundaries: 'alter schema or create fields', constraints: 'Requires resource_type; optional categories selects subsets. Returns attribute types like text, select, actor-reference, record-reference, etc. Actor-reference fields (e.g., owner) require special filter handling.', recoveryHint: 'Use this tool first to understand attribute types before filtering', }), inputSchema: { type: 'object', properties: { resource_type: RESOURCE_TYPE_SCHEMA, categories: { type: 'array', items: { type: 'string' }, description: 'Attribute categories to filter by (e.g., standard, custom)', }, }, required: ['resource_type'], }, annotations: { readOnlyHint: true, }, };
- packages/core/src/tools/handlers.ts:1027-1031 (registration)Dispatch registration mapping 'records_discover_attributes' tool name to the handleDiscoverAttributes implementation.records_discover_attributes: async (client, params) => handleDiscoverAttributes( client, params as Parameters<typeof handleDiscoverAttributes>[1] ),
- src/config/tool-aliases.ts:37-41 (registration)Tool alias registration mapping the queried name 'discover-attributes' to the canonical 'records_discover_attributes' tool.'discover-attributes': { target: 'records_discover_attributes', reason: 'Phase 1 search tool rename (#776)', since: SINCE_PHASE_1, removal: 'v1.x (TBD)',
- Export registration of the discoverAttributesDefinition in the coreToolDefinitions registry.records_discover_attributes: discoverAttributesDefinition,