pylon_create_account
Create a new account in the Pylon customer support platform by specifying account name, domains, owner, and tags for organization management.
Instructions
Create a new account in Pylon
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the account | |
| domains | No | List of domains associated with the account | |
| primary_domain | No | Primary domain | |
| logo_url | No | URL of the account logo | |
| owner_id | No | ID of the account owner | |
| tags | No | Tags to apply to the account |
Implementation Reference
- src/index.ts:76-99 (registration)MCP tool registration for 'pylon_create_account', including input schema with Zod validation and the handler function that delegates to PylonClient.createAccount and formats the response.server.tool( 'pylon_create_account', 'Create a new account in Pylon', { name: z.string().describe('The name of the account'), domains: z .array(z.string()) .optional() .describe('List of domains associated with the account'), primary_domain: z.string().optional().describe('Primary domain'), logo_url: z.string().optional().describe('URL of the account logo'), owner_id: z.string().optional().describe('ID of the account owner'), tags: z .array(z.string()) .optional() .describe('Tags to apply to the account'), }, async (params) => { const result = await client.createAccount(params); return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }], }; }, );
- src/pylon-client.ts:172-176 (handler)Core handler logic in PylonClient for creating an account via POST request to the Pylon API /accounts endpoint.async createAccount( data: Partial<Account> & { name: string }, ): Promise<SingleResponse<Account>> { return this.request<SingleResponse<Account>>('POST', '/accounts', data); }
- src/pylon-client.ts:31-42 (schema)TypeScript interface defining the structure of an Account object, used for typing the createAccount parameters and response.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)Generic private request method in PylonClient that handles all HTTP API calls, including authentication and error handling, used by createAccount.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>; }