pylon_update_tag
Modify existing tags in the Pylon customer support platform by updating their names and colors to organize and categorize support data effectively.
Instructions
Update an existing tag
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The tag ID | |
| value | No | Updated tag name | |
| hex_color | No | Updated hex color |
Implementation Reference
- src/index.ts:551-565 (registration)Registers the MCP tool 'pylon_update_tag' with input schema (id required, value/hex_color optional) and a handler that delegates to PylonClient.updateTag and returns JSON response.
server.tool( 'pylon_update_tag', 'Update an existing tag', { id: z.string().describe('The tag ID'), value: z.string().optional().describe('Updated tag name'), hex_color: z.string().optional().describe('Updated hex color'), }, async ({ id, ...data }) => { const result = await client.updateTag(id, data); return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }], }; }, ); - src/index.ts:554-558 (schema)Zod input schema for the tool parameters.
{ id: z.string().describe('The tag ID'), value: z.string().optional().describe('Updated tag name'), hex_color: z.string().optional().describe('Updated hex color'), }, - src/index.ts:559-564 (handler)Thin MCP tool handler that invokes PylonClient.updateTag.
async ({ id, ...data }) => { const result = await client.updateTag(id, data); return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }], }; }, - src/pylon-client.ts:405-410 (handler)Core handler implementing the tag update by making a PATCH request to the Pylon API /tags/{id} endpoint.
async updateTag( id: string, data: { value?: string; hex_color?: string }, ): Promise<SingleResponse<Tag>> { return this.request<SingleResponse<Tag>>('PATCH', `/tags/${id}`, data); } - src/pylon-client.ts:121-147 (helper)Shared HTTP request helper method used by updateTag to perform the API call.
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>; }