pylon_update_contact
Modify contact details in the Pylon customer support platform, including name, email, account association, avatar, and portal role.
Instructions
Update an existing contact
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The contact ID | |
| name | No | Updated name | |
| No | Updated email | ||
| account_id | No | Updated account association | |
| avatar_url | No | Updated avatar URL | |
| portal_role | No | Updated portal role |
Implementation Reference
- src/pylon-client.ts:237-246 (handler)Core handler logic for updating a contact via PATCH API request to `/contacts/${id}` using the shared request method.async updateContact( id: string, data: Partial<Contact>, ): Promise<SingleResponse<Contact>> { return this.request<SingleResponse<Contact>>( 'PATCH', `/contacts/${id}`, data, ); }
- src/index.ts:227-236 (schema)Zod schema defining the input parameters for the pylon_update_contact tool.id: z.string().describe('The contact ID'), name: z.string().optional().describe('Updated name'), email: z.string().optional().describe('Updated email'), account_id: z.string().optional().describe('Updated account association'), avatar_url: z.string().optional().describe('Updated avatar URL'), portal_role: z .enum(['no_access', 'member', 'admin']) .optional() .describe('Updated portal role'), },
- src/index.ts:223-243 (registration)MCP server tool registration for 'pylon_update_contact', including input schema and thin wrapper handler that delegates to PylonClient.updateContact and formats the response as text.server.tool( 'pylon_update_contact', 'Update an existing contact', { id: z.string().describe('The contact ID'), name: z.string().optional().describe('Updated name'), email: z.string().optional().describe('Updated email'), account_id: z.string().optional().describe('Updated account association'), avatar_url: z.string().optional().describe('Updated avatar URL'), portal_role: z .enum(['no_access', 'member', 'admin']) .optional() .describe('Updated portal role'), }, async ({ id, ...data }) => { const result = await client.updateContact(id, data); return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }], }; }, );
- src/pylon-client.ts:44-53 (helper)TypeScript interface defining the Contact object structure used in updateContact.export interface Contact { id: string; name: string; email?: string; emails?: string[]; avatar_url?: string; account?: { id: string; name: string }; custom_fields?: object; portal_role?: string; }
- src/pylon-client.ts:121-147 (helper)Shared HTTP request method used by updateContact to perform authenticated API calls.private async request<T>( method: string, path: string, body?: object, ): Promise<T> { const url = `${PYLON_API_BASE}${path}`; const headers: Record<string, string> = { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': 'application/json', Accept: 'application/json', }; const response = await fetch(url, { method, headers, body: body ? JSON.stringify(body) : undefined, }); if (!response.ok) { const errorText = await response.text(); throw new Error( `Pylon API error: ${response.status} ${response.statusText} - ${errorText}`, ); } return response.json() as Promise<T>; }