waroom_create_service_label
Create new labels for services in Waroom to organize and categorize incident management data with custom names and colors.
Instructions
特定のサービスに新しいラベルを作成します。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service_name | Yes | サービス名 | |
| name | Yes | ラベル名 | |
| color | Yes | ラベルの色(6桁の16進数カラーコード、例: ff0000) |
Implementation Reference
- src/tools/labels.ts:46-67 (handler)The MCP tool handler function that calls WaroomClient.createServiceLabel with the input parameters and returns the JSON response or an error message as text content.async (params) => { try { const response = await waroomClient.createServiceLabel( params.service_name, params.name, params.color ); return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: `サービスラベルの作成に失敗しました: ${error}` }] }; } }
- src/tools/labels.ts:41-45 (schema)Zod schema defining the input parameters for the tool: service_name (string), name (string), color (6-digit hex string).{ service_name: z.string().min(1).max(100).describe('サービス名'), name: z.string().min(1).max(100).describe('ラベル名'), color: z.string().regex(/^[0-9a-fA-F]{6}$/).describe('ラベルの色(6桁の16進数カラーコード、例: ff0000)'), },
- src/tools/labels.ts:38-68 (registration)Direct registration of the 'waroom_create_service_label' tool to the MCP server using server.tool(), specifying name, description, input schema, and handler function.server.tool( 'waroom_create_service_label', '特定のサービスに新しいラベルを作成します。', { service_name: z.string().min(1).max(100).describe('サービス名'), name: z.string().min(1).max(100).describe('ラベル名'), color: z.string().regex(/^[0-9a-fA-F]{6}$/).describe('ラベルの色(6桁の16進数カラーコード、例: ff0000)'), }, async (params) => { try { const response = await waroomClient.createServiceLabel( params.service_name, params.name, params.color ); return { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: `サービスラベルの作成に失敗しました: ${error}` }] }; } } );
- src/WaroomClient.ts:172-184 (helper)Supporting method in WaroomClient that performs the actual HTTP POST request to the Waroom API to create a service label.async createServiceLabel(serviceName: string, name: string, color: string) { try { const response = await this.axiosInstance.post(`${this.baseUrl}/services/${serviceName}/labels`, { label: { name, color } }); return response.data; } catch (error) { throw new Error(`Failed to create service label: ${error}`); } }
- src/main.ts:29-29 (registration)Top-level call to createLabelsTools(server, waroomClient) which registers all label-related tools, including 'waroom_create_service_label'.createLabelsTools(server, waroomClient);