pylon_get_contact
Retrieve contact details by providing the contact ID.
Instructions
Get contact details by ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The contact ID |
Implementation Reference
- src/index.ts:425-439 (handler)The tool handler for 'pylon_get_contact'. It accepts a contact ID, calls client.getContact(id), transforms the result using toContactMinimal(), and returns the contact as formatted JSON.
server.tool( 'pylon_get_contact', 'Get contact details by ID.', { id: z.string().describe('The contact ID'), }, async ({ id }) => { const result = await client.getContact(id); // Return minimal fields to reduce context size const contact = toContactMinimal(result.data as unknown as Record<string, unknown>); return { content: [{ type: 'text', text: JSON.stringify(contact, null, 2) }], }; }, ); - src/schemas.ts:95-101 (schema)ContactMinimalSchema – defines the shape of the contact data returned by the tool (id, name, email, account_id, portal_role).
export const ContactMinimalSchema = z.object({ id: z.string(), name: z.string(), email: z.string().nullable().optional(), account_id: z.string().nullable().optional(), portal_role: z.string().nullable().optional(), }); - src/schemas.ts:299-308 (schema)toContactMinimal() – transforms raw API response to ContactMinimal format used by the tool handler.
export function toContactMinimal(raw: Record<string, unknown>): ContactMinimal { const account = raw['account'] as { id?: string } | null | undefined; return { id: raw['id'] as string, name: raw['name'] as string, email: raw['email'] as string | null | undefined, account_id: account?.id ?? (raw['account_id'] as string | null | undefined), portal_role: raw['portal_role'] as string | null | undefined, }; } - src/pylon-client.ts:381-383 (helper)PylonClient.getContact() – makes a GET request to /contacts/{id} to fetch a single contact from the Pylon API.
async getContact(id: string): Promise<SingleResponse<Contact>> { return this.request<SingleResponse<Contact>>('GET', `/contacts/${id}`); } - src/index.ts:425-439 (registration)The tool registration via server.tool('pylon_get_contact', ...) with schema for the 'id' parameter.
server.tool( 'pylon_get_contact', 'Get contact details by ID.', { id: z.string().describe('The contact ID'), }, async ({ id }) => { const result = await client.getContact(id); // Return minimal fields to reduce context size const contact = toContactMinimal(result.data as unknown as Record<string, unknown>); return { content: [{ type: 'text', text: JSON.stringify(contact, null, 2) }], }; }, );