Skip to main content
Glama
tools.ts.fix2.26 kB
// Fix for line 1091-1117 in tools.ts // Handle record creation if (toolType === 'create') { // Special handling for resource-specific create tools like create-company if (toolName === 'create-company' || toolName === 'create-person') { const attributes = request.params.arguments?.attributes || {}; try { const result = await toolConfig.handler(attributes); const formattedResult = toolConfig.formatResult(result); return { content: [ { type: "text", text: formattedResult, }, ], isError: false, }; } catch (error) { const errorResource = toolName === 'create-company' ? 'companies' : 'people'; return createErrorResult( error instanceof Error ? error : new Error("Unknown error"), `objects/${errorResource}/records`, "POST", (error as any).response?.data || {} ); } } else { // Generic record creation that requires objectSlug const objectSlug = request.params.arguments?.objectSlug as string; const objectId = request.params.arguments?.objectId as string; const attributes = request.params.arguments?.attributes || {}; try { const recordCreateConfig = toolConfig as RecordCreateToolConfig; const record = await recordCreateConfig.handler(objectSlug, attributes, objectId); return { content: [ { type: "text", text: `Record created successfully in ${objectSlug}:\nID: ${record.id?.record_id || 'unknown'}\n${JSON.stringify(record, null, 2)}`, }, ], isError: false, }; } catch (error) { return createErrorResult( error instanceof Error ? error : new Error("Unknown error"), `objects/${objectSlug}/records`, "POST", (error as any).response?.data || {} ); } } }

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