pylon_get_account
Retrieve detailed information about a customer account using its ID. Access key account data to manage support interactions efficiently.
Instructions
Get account details by ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The account ID or external ID |
Implementation Reference
- src/index.ts:235-249 (handler)The tool registration and handler for 'pylon_get_account'. Calls client.getAccount(id), transforms via toAccountMinimal, and returns JSON result.
server.tool( 'pylon_get_account', 'Get account details by ID.', { id: z.string().describe('The account ID or external ID'), }, async ({ id }) => { const result = await client.getAccount(id); // Return minimal fields to reduce context size const account = toAccountMinimal(result.data as unknown as Record<string, unknown>); return { content: [{ type: 'text', text: JSON.stringify(account, null, 2) }], }; }, ); - src/index.ts:235-249 (registration)The server.tool() call that registers 'pylon_get_account' with MCP.
server.tool( 'pylon_get_account', 'Get account details by ID.', { id: z.string().describe('The account ID or external ID'), }, async ({ id }) => { const result = await client.getAccount(id); // Return minimal fields to reduce context size const account = toAccountMinimal(result.data as unknown as Record<string, unknown>); return { content: [{ type: 'text', text: JSON.stringify(account, null, 2) }], }; }, ); - src/schemas.ts:74-80 (schema)The AccountMinimalSchema defining the shape of the returned account data (id, name, primary_domain, owner_id, tags).
export const AccountMinimalSchema = z.object({ id: z.string(), name: z.string(), primary_domain: z.string().nullable().optional(), owner_id: z.string().nullable().optional(), tags: z.array(z.string()).nullable().optional(), }); - src/schemas.ts:271-280 (helper)The toAccountMinimal helper function that transforms raw API response to AccountMinimal format.
export function toAccountMinimal(raw: Record<string, unknown>): AccountMinimal { const owner = raw['owner'] as { id?: string } | null | undefined; return { id: raw['id'] as string, name: raw['name'] as string, primary_domain: raw['primary_domain'] as string | null | undefined, owner_id: owner?.id ?? (raw['owner_id'] as string | null | undefined), tags: raw['tags'] as string[] | null | undefined, }; } - src/pylon-client.ts:321-323 (helper)The getAccount method on PylonClient that performs the HTTP GET request to /accounts/{id}.
async getAccount(id: string): Promise<SingleResponse<Account>> { return this.request<SingleResponse<Account>>('GET', `/accounts/${id}`); }