Skip to main content
Glama
utils.ts1.38 kB
/** * Dispatcher utilities */ import { loadMappingConfig } from '@/utils/config-loader.js'; /** * Normalize error messages by stripping tool execution prefixes. */ export function normalizeToolMsg(msg: string): string { return msg.replace(/^Error executing tool '.*?':\s*/, ''); } /** * Standard resource types always available in the system */ const STANDARD_RESOURCE_TYPES = [ 'records', 'lists', 'people', 'companies', 'tasks', 'deals', 'notes', ] as const; /** * Canonicalize resource type to valid values and prevent mutations. * Supports both standard types and custom objects discovered via config. * * Custom objects require running `attio-discover attributes -a` first * to populate the mapping config. */ export function canonicalizeResourceType(rt: unknown): string { const value = String(rt ?? '').toLowerCase(); // Load custom objects from mapping config (e.g., "funds", "investment_opportunities") const config = loadMappingConfig(); const customObjects = Object.keys(config.mappings?.attributes?.objects || {}); // Merge standard + custom (deduplicated) const validTypes = [ ...new Set([...STANDARD_RESOURCE_TYPES, ...customObjects]), ]; if (!validTypes.includes(value)) { throw new Error( `Invalid resource_type: ${value}. Must be one of: ${validTypes.join(', ')}` ); } return value; }

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