Skip to main content
Glama
notes.ts2.35 kB
/** * Note operations for People */ import { getObjectNotes, createObjectNote, } from '../../api/operations/index.js'; import { ResourceType, AttioNote } from '../../types/attio.js'; import { FilterValidationError } from '../../errors/api-errors.js'; import { isValidId } from '../../utils/validation.js'; /** * Gets notes for a specific person * * @param personId - ID of the person * @param limit - Maximum number of notes to return (default: 10) * @param offset - Offset for pagination (default: 0) * @returns Array of notes */ export async function getPersonNotes( personId: string, limit: number = 10, offset: number = 0 ): Promise<AttioNote[]> { try { if (!isValidId(personId)) { throw new FilterValidationError(`Invalid person ID: ${personId}`); } return await getObjectNotes(ResourceType.PEOPLE, personId, limit, offset); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); if (errorMessage.includes('validation')) { throw new FilterValidationError( `Note retrieval validation failed: ${errorMessage}` ); } throw new Error(`Failed to get person notes: ${errorMessage}`); } } /** * Creates a note for a person * * @param personId - ID of the person * @param title - Title of the note * @param content - Content of the note * @returns Created note */ export async function createPersonNote( personId: string, title: string, content: string ): Promise<AttioNote> { try { if (!isValidId(personId)) { throw new FilterValidationError(`Invalid person ID: ${personId}`); } if (!title || title.trim().length === 0) { throw new FilterValidationError('Note title cannot be empty'); } if (!content || content.trim().length === 0) { throw new FilterValidationError('Note content cannot be empty'); } return await createObjectNote( ResourceType.PEOPLE, personId, title, content ); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); if (errorMessage.includes('validation')) { throw new FilterValidationError( `Note creation validation failed: ${errorMessage}` ); } throw new Error(`Failed to create person note: ${errorMessage}`); } }

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