pylon_delete_account
Remove a customer account from the Pylon support platform by providing the account ID to delete user data and records.
Instructions
Delete an account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The account ID to delete |
Implementation Reference
- src/index.ts:121-133 (registration)Registration of the 'pylon_delete_account' MCP tool, including description, input schema (account ID), and inline handler that calls PylonClient.deleteAccount and returns JSON-formatted result.server.tool( 'pylon_delete_account', 'Delete an account', { id: z.string().describe('The account ID to delete'), }, async ({ id }) => { const result = await client.deleteAccount(id); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }, );
- src/index.ts:127-132 (handler)Inline handler function executing the tool logic: deletes the account via client and returns response.async ({ id }) => { const result = await client.deleteAccount(id); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; },
- src/index.ts:124-126 (schema)Zod input schema defining the required 'id' parameter.{ id: z.string().describe('The account ID to delete'), },
- src/pylon-client.ts:189-196 (helper)PylonClient.deleteAccount method: performs authenticated DELETE request to Pylon API endpoint /accounts/{id}.async deleteAccount( id: string, ): Promise<SingleResponse<{ success: boolean }>> { return this.request<SingleResponse<{ success: boolean }>>( 'DELETE', `/accounts/${id}`, ); }
- src/pylon-client.ts:121-147 (helper)Private request method in PylonClient used for all API calls, handling authentication, fetch, error handling, and JSON parsing.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>; }