poker_updateUnit
Updates measurement units for task management, allowing modification of length, angle, density, and radioactivity units while maintaining complete unit structure integrity.
Instructions
既存単位設定を更新します(部分更新可能だが4つのキーは常に維持)- 完全性保証
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| angle | No | 新しい角度の単位 | |
| density | No | 新しい密度の単位 | |
| length | No | 新しい長さの単位 | |
| radioactivity | No | 新しい放射能の単位 |
Implementation Reference
- src/mcp/handlers/unitHandlers.js:172-215 (handler)The main handler function for the 'poker_updateUnit' tool. Validates arguments, invokes taskManager.updateUnit(args), handles specific errors, and returns formatted success/error response.async updateUnit(args) { try { if (!args || Object.keys(args).length === 0) { throw new ValidationError('更新する内容が指定されていません', 'updates', args); } logger.info('4キー保持単位更新開始', { updates: args }); // TaskManagerの4キー保持更新機能を利用 const result = await taskManager.updateUnit(args); logger.info('4キー保持単位更新完了', { updates: args }); return { success: true, message: result, updated: { ...args, integrity: '4-key-preserved' } }; } catch (error) { logger.error('単位設定更新エラー', { args, error: error.message }); // マニフェスト仕様のupdate専用エラーコード処理 if (error.code === -32087) { return { success: false, error: error.message, details: { errorCode: error.code, suggestion: 'proposeUnitメソッドを使用してください', missingObject: 'unit', objectType: '単位設定' } }; } throw error; } },
- src/mcp/tools/unitTools.js:52-83 (schema)Tool definition including name, description, and input schema for 'poker_updateUnit'. Specifies partial updates for unit settings with validation rules.{ name: 'poker_updateUnit', description: '既存単位設定を更新します(部分更新可能だが4つのキーは常に維持)- 完全性保証', inputSchema: { type: 'object', properties: { length: { type: 'string', enum: ['m', 'cm', 'mm'], description: '新しい長さの単位' }, angle: { type: 'string', enum: ['radian', 'degree'], description: '新しい角度の単位' }, density: { type: 'string', enum: ['g/cm3'], description: '新しい密度の単位' }, radioactivity: { type: 'string', enum: ['Bq'], description: '新しい放射能の単位' } }, minProperties: 1, additionalProperties: false, title: '4キー保持更新', description: '部分更新可能ですが、結果として4キー構造は常に保持されます。' }
- src/mcp/handlers/index.js:32-36 (registration)Spreads the unit handlers (including updateUnit) from createUnitHandlers into the combined handlers object used by the MCP server.// 単位操作 ...createUnitHandlers(taskManager), // 計算操作
- src/mcp/server.js:43-57 (registration)Registers the general tool call handler which dynamically maps 'poker_updateUnit' to 'updateUnit' handler and executes it.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; logger.info(`MCP Tool実行: ${name}`, { args }); // ハンドラー名をツール名から生成(プレフィックス除去) const handlerName = name.replace('poker_', ''); const handler = this.handlers[handlerName]; if (!handler) { throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); } return await safeExecute(async () => handler(args), { tool: name })(); });
- src/mcp/server.js:38-40 (registration)Registers the listTools handler that returns all tool definitions including 'poker_updateUnit'.this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools }; });