pylon_get_account
Retrieve a specific account from the Pylon customer support platform by providing its unique ID or external identifier.
Instructions
Get a specific account by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The account ID or external ID |
Implementation Reference
- src/index.ts:62-74 (registration)Registers the pylon_get_account MCP tool, including input schema (id: string) and handler that calls PylonClient.getAccount and formats the response as text.server.tool( 'pylon_get_account', 'Get a specific account by ID', { id: z.string().describe('The account ID or external ID'), }, async ({ id }) => { const result = await client.getAccount(id); return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }], }; }, );
- src/pylon-client.ts:168-170 (handler)The core handler logic for retrieving an account via API GET request to /accounts/{id}, using the private request method.async getAccount(id: string): Promise<SingleResponse<Account>> { return this.request<SingleResponse<Account>>('GET', `/accounts/${id}`); }
- src/pylon-client.ts:31-42 (schema)TypeScript interface defining the structure of an Account object returned by the Pylon API.export interface Account { id: string; name: string; domains?: string[]; primary_domain?: string; logo_url?: string; owner_id?: string; channels?: object[]; custom_fields?: object; external_ids?: object[]; tags?: string[]; }
- src/pylon-client.ts:121-147 (helper)Private helper method used by all client methods to perform authenticated HTTP requests to the Pylon API.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>; }