poker-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +241 -0
  2. package/config/mcp-manifest.json +1713 -0
  3. package/config/package-lock.json +1335 -0
  4. package/config/poker_mcp.code-workspace +8 -0
  5. package/package.json +51 -0
  6. package/src/config/ConfigManager.js +120 -0
  7. package/src/config/default.json +62 -0
  8. package/src/mcp/handlers/bodyHandlers.js +63 -0
  9. package/src/mcp/handlers/buildupFactorHandlers.js +43 -0
  10. package/src/mcp/handlers/calculationHandlers.js +265 -0
  11. package/src/mcp/handlers/detectorHandlers.js +201 -0
  12. package/src/mcp/handlers/index.js +43 -0
  13. package/src/mcp/handlers/sourceHandlers.js +25 -0
  14. package/src/mcp/handlers/transformHandlers.js +26 -0
  15. package/src/mcp/handlers/unitHandlers.js +305 -0
  16. package/src/mcp/handlers/zoneHandlers.js +83 -0
  17. package/src/mcp/middleware/errorHandler.js +49 -0
  18. package/src/mcp/middleware/requestValidator.js +129 -0
  19. package/src/mcp/server.js +76 -0
  20. package/src/mcp/tools/bodyTools.js +185 -0
  21. package/src/mcp/tools/buildupFactorTools.js +82 -0
  22. package/src/mcp/tools/calculationTools.js +58 -0
  23. package/src/mcp/tools/commonTools.js +22 -0
  24. package/src/mcp/tools/detectorTools.js +131 -0
  25. package/src/mcp/tools/index.js +34 -0
  26. package/src/mcp/tools/sourceTools.js +726 -0
  27. package/src/mcp/tools/sourceTools_fixed_part2.js +41 -0
  28. package/src/mcp/tools/transformTools.js +73 -0
  29. package/src/mcp/tools/unitTools.js +137 -0
  30. package/src/mcp/tools/zoneTools.js +65 -0
  31. package/src/mcp_server_stdio_v4.js +45 -0
  32. package/src/routes/restApi.js +184 -0
  33. package/src/services/CalculationService.js +525 -0
  34. package/src/services/DataManager.js +738 -0
  35. package/src/services/TaskManager.js +1622 -0
  36. package/src/utils/MaterialAlternatives.js +189 -0
  37. package/src/utils/errorHandler.js +68 -0
  38. package/src/utils/errors.js +37 -0
  39. package/src/utils/logger.js +24 -0
  40. package/src/utils/logger_no_color.js +28 -0
  41. package/src/utils/mcpErrors.js +225 -0
  42. package/src/validators/CMBValidator.js +191 -0
  43. package/src/validators/DetectorValidator.js +512 -0
  44. package/src/validators/ManifestValidator.js +249 -0
  45. package/src/validators/NuclideValidator.js +171 -0
  46. package/src/validators/PhysicsValidator.js +401 -0
  47. package/src/validators/PhysicsValidatorSimple.js +87 -0
  48. package/src/validators/SourceValidator.js +515 -0
  49. package/src/validators/TransformValidator.js +472 -0
  50. package/src/validators/UnitValidator.js +562 -0
@@ -0,0 +1,49 @@
1
+ // mcp/middleware/errorHandler.js
2
+ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
3
+ import { ValidationError, PhysicsError, CalculationError } from '../../utils/errors.js';
4
+ import { PokerMcpError } from '../../utils/mcpErrors.js';
5
+ import { logger } from '../../utils/logger.js';
6
+
7
+ export function handleMcpError(error, context = {}) {
8
+ logger.error('MCP操作エラー', { error: error.message, context });
9
+
10
+ // PokerMcpErrorは既に適切なMcpErrorなのでそのまま返す
11
+ if (error instanceof PokerMcpError) {
12
+ return error;
13
+ }
14
+
15
+ // CalculationError の処理 - MCPエラーコードが指定されている場合は使用
16
+ if (error instanceof CalculationError) {
17
+ const mcpCode = error.mcpErrorCode || ErrorCode.InternalError;
18
+ return new McpError(mcpCode, `計算エラー: ${error.message}`, error.context);
19
+ }
20
+
21
+ // 従来の ValidationError を適切な PokerMcpError に変換
22
+ if (error instanceof ValidationError) {
23
+ return PokerMcpError.validationError(error.message, error.field, error.value);
24
+ }
25
+
26
+ // PhysicsError の処理
27
+ if (error instanceof PhysicsError) {
28
+ return PokerMcpError.validationError(`物理パラメータエラー: ${error.message}`, error.field, error.value);
29
+ }
30
+
31
+ // 既存のMcpError
32
+ if (error instanceof McpError) {
33
+ return error;
34
+ }
35
+
36
+ // その他の予期しないエラー
37
+ return new McpError(ErrorCode.InternalError, `内部エラー: ${error.message}`);
38
+ }
39
+
40
+ export function safeExecute(fn, context = {}) {
41
+ return async (request) => {
42
+ try {
43
+ const result = await fn(request);
44
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
45
+ } catch (error) {
46
+ throw handleMcpError(error, context);
47
+ }
48
+ };
49
+ }
@@ -0,0 +1,129 @@
1
+ // mcp/middleware/requestValidator.js
2
+ import { ValidationError } from '../../utils/errors.js';
3
+ import { MaterialAlternatives } from '../../utils/MaterialAlternatives.js';
4
+
5
+ export function validateBodyRequest(args) {
6
+ if (!args.name || typeof args.name !== 'string') {
7
+ throw new ValidationError('立体名は必須です', 'name', args.name);
8
+ }
9
+
10
+ if (!args.type || typeof args.type !== 'string') {
11
+ throw new ValidationError('立体タイプは必須です', 'type', args.type);
12
+ }
13
+
14
+ const validTypes = ['SPH', 'RCC', 'RPP', 'BOX', 'CMB', 'TOR', 'ELL', 'REC', 'TRC', 'WED'];
15
+ if (!validTypes.includes(args.type)) {
16
+ throw new ValidationError(`無効な立体タイプ: ${args.type}`, 'type', args.type);
17
+ }
18
+ }
19
+
20
+ export function validateZoneRequest(args) {
21
+ if (!args.body_name || typeof args.body_name !== 'string') {
22
+ throw new ValidationError('立体名は必須です', 'body_name', args.body_name);
23
+ }
24
+
25
+ if (!args.material || typeof args.material !== 'string') {
26
+ throw new ValidationError('材料名は必須です', 'material', args.material);
27
+ }
28
+
29
+ // 材料代替機能付きバリデーション
30
+ try {
31
+ MaterialAlternatives.validateMaterialWithSuggestion(args.material, 'material');
32
+ } catch (error) {
33
+ // MaterialAlternativesからのエラーをValidationErrorに変換
34
+ throw new ValidationError(error.message, 'material', args.material);
35
+ }
36
+ }
37
+
38
+ export function validateTransformRequest(args) {
39
+ if (!args.name || typeof args.name !== 'string') {
40
+ throw new ValidationError('変換名は必須です', 'name', args.name);
41
+ }
42
+
43
+ if (!args.operations || !Array.isArray(args.operations)) {
44
+ throw new ValidationError('操作配列は必須です', 'operations', args.operations);
45
+ }
46
+ }
47
+
48
+ export function validateSourceRequest(args) {
49
+ if (!args.name || typeof args.name !== 'string') {
50
+ throw new ValidationError('線源名は必須です', 'name', args.name);
51
+ }
52
+
53
+ if (!args.type || typeof args.type !== 'string') {
54
+ throw new ValidationError('線源タイプは必須です', 'type', args.type);
55
+ }
56
+
57
+ if (!args.inventory || !Array.isArray(args.inventory)) {
58
+ throw new ValidationError('インベントリは必須の配列です', 'inventory', args.inventory);
59
+ }
60
+ }
61
+
62
+ export function validateBuildupFactorRequest(args) {
63
+ if (!args.material || typeof args.material !== 'string') {
64
+ throw new ValidationError('材料名は必須です', 'material', args.material);
65
+ }
66
+
67
+ // スラント補正パラメータの必須チェック
68
+ if (args.use_slant_correction === undefined) {
69
+ throw new ValidationError(
70
+ 'use_slant_correction parameter is required for high-precision radiation shielding calculation',
71
+ 'use_slant_correction',
72
+ args.use_slant_correction
73
+ );
74
+ }
75
+
76
+ if (typeof args.use_slant_correction !== 'boolean') {
77
+ throw new ValidationError(
78
+ 'use_slant_correction must be boolean',
79
+ 'use_slant_correction',
80
+ args.use_slant_correction
81
+ );
82
+ }
83
+
84
+ // 有限媒体補正パラメータの必須チェック
85
+ if (args.use_finite_medium_correction === undefined) {
86
+ throw new ValidationError(
87
+ 'use_finite_medium_correction parameter is required for accurate boundary effect analysis',
88
+ 'use_finite_medium_correction',
89
+ args.use_finite_medium_correction
90
+ );
91
+ }
92
+
93
+ if (typeof args.use_finite_medium_correction !== 'boolean') {
94
+ throw new ValidationError(
95
+ 'use_finite_medium_correction must be boolean',
96
+ 'use_finite_medium_correction',
97
+ args.use_finite_medium_correction
98
+ );
99
+ }
100
+ }
101
+
102
+ export function validateUpdateSourceRequest(args) {
103
+ if (!args.name || typeof args.name !== 'string') {
104
+ throw new ValidationError('線源名は必須です', 'name', args.name);
105
+ }
106
+
107
+ // 更新可能なフィールドのみチェック
108
+ const allowedFields = ['name', 'position', 'inventory', 'cutoff_rate'];
109
+ const providedFields = Object.keys(args);
110
+ const invalidFields = providedFields.filter(field => !allowedFields.includes(field));
111
+
112
+ if (invalidFields.length > 0) {
113
+ throw new ValidationError(`更新不可なフィールド: ${invalidFields.join(', ')}`, 'fields', invalidFields);
114
+ }
115
+
116
+ if (args.inventory && !Array.isArray(args.inventory)) {
117
+ throw new ValidationError('インベントリは配列で指定してください', 'inventory', args.inventory);
118
+ }
119
+
120
+ if (args.cutoff_rate !== undefined && (typeof args.cutoff_rate !== 'number' || args.cutoff_rate < 0)) {
121
+ throw new ValidationError('cutoff_rateは0以上の数値で指定してください', 'cutoff_rate', args.cutoff_rate);
122
+ }
123
+ }
124
+
125
+ export function validateDeleteSourceRequest(args) {
126
+ if (!args.name || typeof args.name !== 'string') {
127
+ throw new ValidationError('線源名は必須です', 'name', args.name);
128
+ }
129
+ }
@@ -0,0 +1,76 @@
1
+ // mcp/server.js
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
5
+ import { TaskManager } from '../services/TaskManager.js';
6
+ import { allTools } from './tools/index.js';
7
+ import { createAllHandlers } from './handlers/index.js';
8
+ import { safeExecute } from './middleware/errorHandler.js';
9
+ import { logger } from '../utils/logger.js';
10
+
11
+ export class PokerMcpServer {
12
+ constructor(yamlFile = 'tasks/poker.yaml', pendingFile = 'tasks/pending_changes.json') {
13
+ this.server = new Server(
14
+ {
15
+ name: 'poker-mcp',
16
+ version: '1.0.0',
17
+ },
18
+ {
19
+ capabilities: {
20
+ tools: {},
21
+ },
22
+ }
23
+ );
24
+
25
+ this.taskManager = new TaskManager(yamlFile, pendingFile);
26
+ this.handlers = null;
27
+ }
28
+
29
+ async initialize() {
30
+ try {
31
+ // TaskManager初期化
32
+ await this.taskManager.initialize();
33
+
34
+ // ハンドラー作成
35
+ this.handlers = createAllHandlers(this.taskManager);
36
+
37
+ // ツール一覧ハンドラー
38
+ this.server.setRequestHandler(ListToolsRequestSchema, async () => {
39
+ return { tools: allTools };
40
+ });
41
+
42
+ // ツール実行ハンドラー
43
+ this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
44
+ const { name, arguments: args } = request.params;
45
+
46
+ logger.info(`MCP Tool実行: ${name}`, { args });
47
+
48
+ // ハンドラー名をツール名から生成(プレフィックス除去)
49
+ const handlerName = name.replace('poker_', '');
50
+
51
+ const handler = this.handlers[handlerName];
52
+ if (!handler) {
53
+ throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
54
+ }
55
+
56
+ return await safeExecute(async () => handler(args), { tool: name })();
57
+ });
58
+
59
+ logger.info('PokerMcpServer初期化完了');
60
+ } catch (error) {
61
+ logger.error('PokerMcpServer初期化エラー', { error: error.message });
62
+ throw error;
63
+ }
64
+ }
65
+
66
+ async start() {
67
+ try {
68
+ const transport = new StdioServerTransport();
69
+ await this.server.connect(transport);
70
+ logger.info('Poker MCP Server started on stdio');
71
+ } catch (error) {
72
+ logger.error('MCPサーバー開始エラー', { error: error.message });
73
+ throw error;
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,185 @@
1
+ // mcp/tools/bodyTools.js
2
+ export const bodyTools = [
3
+ {
4
+ name: 'poker_proposeBody',
5
+ description: '新しい3D立体を提案します(自動バックアップ付き)',
6
+ inputSchema: {
7
+ type: 'object',
8
+ properties: {
9
+ name: {
10
+ type: 'string',
11
+ description: '立体の一意な名前'
12
+ },
13
+ type: {
14
+ type: 'string',
15
+ description: '立体タイプ',
16
+ enum: ['SPH', 'RCC', 'RPP', 'BOX', 'CMB', 'TOR', 'ELL', 'REC', 'TRC', 'WED']
17
+ },
18
+ center: {
19
+ type: 'string',
20
+ description: '中心座標 (x y z形式) - SPH,ELL,TOR用'
21
+ },
22
+ radius: {
23
+ type: 'number',
24
+ description: '半径 - SPH, RCC用',
25
+ minimum: 0.001,
26
+ maximum: 10000
27
+ },
28
+ bottom_center: {
29
+ type: 'string',
30
+ description: '底面中心座標 (x y z形式) - RCC,TRC,REC用'
31
+ },
32
+ height_vector: {
33
+ type: 'string',
34
+ description: '高さベクトル (x y z形式) - RCC,TRC,REC,WED用'
35
+ },
36
+ min: {
37
+ type: 'string',
38
+ description: '最小座標 (x y z形式) - RPP用'
39
+ },
40
+ max: {
41
+ type: 'string',
42
+ description: '最大座標 (x y z形式) - RPP用'
43
+ },
44
+ vertex: {
45
+ type: 'string',
46
+ description: '頂点座標 (x y z形式) - BOX,WED用'
47
+ },
48
+ edge_1: {
49
+ type: 'string',
50
+ description: 'エッジ1ベクトル (x y z形式) - BOX用'
51
+ },
52
+ edge_2: {
53
+ type: 'string',
54
+ description: 'エッジ2ベクトル (x y z形式) - BOX用'
55
+ },
56
+ edge_3: {
57
+ type: 'string',
58
+ description: 'エッジ3ベクトル (x y z形式) - BOX用'
59
+ },
60
+ expression: {
61
+ type: 'string',
62
+ description: '組み合わせ式 - CMB用'
63
+ },
64
+ // TOR用パラメータ
65
+ normal: {
66
+ type: 'string',
67
+ description: '法線ベクトル (x y z形式) - TOR用'
68
+ },
69
+ major_radius: {
70
+ type: 'number',
71
+ description: '主半径 - TOR用',
72
+ minimum: 0.001,
73
+ maximum: 10000
74
+ },
75
+ minor_radius_horizontal: {
76
+ type: 'number',
77
+ description: '水平方向副半径 - TOR用',
78
+ minimum: 0.001,
79
+ maximum: 10000
80
+ },
81
+ minor_radius_vertical: {
82
+ type: 'number',
83
+ description: '垂直方向副半径 - TOR用',
84
+ minimum: 0.001,
85
+ maximum: 10000
86
+ },
87
+ // ELL用パラメータ
88
+ radius_vector_1: {
89
+ type: 'string',
90
+ description: '半径ベクトル1 (x y z形式) - ELL,REC用'
91
+ },
92
+ radius_vector_2: {
93
+ type: 'string',
94
+ description: '半径ベクトル2 (x y z形式) - ELL,REC用'
95
+ },
96
+ radius_vector_3: {
97
+ type: 'string',
98
+ description: '半径ベクトル3 (x y z形式) - ELL用'
99
+ },
100
+ // TRC用パラメータ
101
+ bottom_radius: {
102
+ type: 'number',
103
+ description: '底面半径 - TRC用',
104
+ minimum: 0.001,
105
+ maximum: 10000
106
+ },
107
+ top_radius: {
108
+ type: 'number',
109
+ description: '上面半径 - TRC用',
110
+ minimum: 0.001,
111
+ maximum: 10000
112
+ },
113
+ // WED用パラメータ
114
+ width_vector: {
115
+ type: 'string',
116
+ description: '幅ベクトル (x y z形式) - WED用'
117
+ },
118
+ depth_vector: {
119
+ type: 'string',
120
+ description: '奥行きベクトル (x y z形式) - WED用'
121
+ },
122
+ transform: {
123
+ type: 'string',
124
+ description: '適用する変換名'
125
+ }
126
+ },
127
+ required: ['name', 'type']
128
+ }
129
+ },
130
+ {
131
+ name: 'poker_updateBody',
132
+ description: '既存立体のパラメータを更新します',
133
+ inputSchema: {
134
+ type: 'object',
135
+ properties: {
136
+ name: {
137
+ type: 'string',
138
+ description: '更新する立体名'
139
+ },
140
+ center: { type: 'string', description: '新しい中心座標 (x y z形式)' },
141
+ radius: { type: 'number', description: '新しい半径', minimum: 0.001, maximum: 10000 },
142
+ bottom_center: { type: 'string', description: '新しい底面中心座標 (x y z形式)' },
143
+ height_vector: { type: 'string', description: '新しい高さベクトル (x y z形式)' },
144
+ min: { type: 'string', description: '新しい最小座標 (x y z形式)' },
145
+ max: { type: 'string', description: '新しい最大座標 (x y z形式)' },
146
+ vertex: { type: 'string', description: '新しい頂点座標 (x y z形式)' },
147
+ edge_1: { type: 'string', description: '新しいエッジ1ベクトル (x y z形式)' },
148
+ edge_2: { type: 'string', description: '新しいエッジ2ベクトル (x y z形式)' },
149
+ edge_3: { type: 'string', description: '新しいエッジ3ベクトル (x y z形式)' },
150
+ expression: { type: 'string', description: '新しい組み合わせ式' },
151
+ // TOR用パラメータ
152
+ normal: { type: 'string', description: '新しい法線ベクトル (x y z形式)' },
153
+ major_radius: { type: 'number', description: '新しい主半径', minimum: 0.001, maximum: 10000 },
154
+ minor_radius_horizontal: { type: 'number', description: '新しい水平方向副半径', minimum: 0.001, maximum: 10000 },
155
+ minor_radius_vertical: { type: 'number', description: '新しい垂直方向副半径', minimum: 0.001, maximum: 10000 },
156
+ // ELL用パラメータ
157
+ radius_vector_1: { type: 'string', description: '新しい半径ベクトル1 (x y z形式)' },
158
+ radius_vector_2: { type: 'string', description: '新しい半径ベクトル2 (x y z形式)' },
159
+ radius_vector_3: { type: 'string', description: '新しい半径ベクトル3 (x y z形式)' },
160
+ // TRC用パラメータ
161
+ bottom_radius: { type: 'number', description: '新しい底面半径', minimum: 0.001, maximum: 10000 },
162
+ top_radius: { type: 'number', description: '新しい上面半径', minimum: 0.001, maximum: 10000 },
163
+ // WED用パラメータ
164
+ width_vector: { type: 'string', description: '新しい幅ベクトル (x y z形式)' },
165
+ depth_vector: { type: 'string', description: '新しい奥行きベクトル (x y z形式)' },
166
+ transform: { type: 'string', description: '新しい変換名' }
167
+ },
168
+ required: ['name']
169
+ }
170
+ },
171
+ {
172
+ name: 'poker_deleteBody',
173
+ description: '立体を削除します(依存関係チェック付き)',
174
+ inputSchema: {
175
+ type: 'object',
176
+ properties: {
177
+ name: {
178
+ type: 'string',
179
+ description: '削除する立体名'
180
+ }
181
+ },
182
+ required: ['name']
183
+ }
184
+ }
185
+ ];
@@ -0,0 +1,82 @@
1
+ // mcp/tools/buildupFactorTools.js
2
+ export const buildupFactorTools = [
3
+ {
4
+ name: 'poker_proposeBuildupFactor',
5
+ description: 'ビルドアップ係数を提案します',
6
+ inputSchema: {
7
+ type: 'object',
8
+ properties: {
9
+ material: {
10
+ type: 'string',
11
+ description: '材料名'
12
+ },
13
+ use_slant_correction: {
14
+ type: 'boolean',
15
+ description: 'スラント補正を使用するか',
16
+ default: false
17
+ },
18
+ use_finite_medium_correction: {
19
+ type: 'boolean',
20
+ description: '有限媒体補正を使用するか',
21
+ default: false
22
+ }
23
+ },
24
+ required: ['material', 'use_slant_correction', 'use_finite_medium_correction']
25
+ }
26
+ },
27
+ {
28
+ name: 'poker_updateBuildupFactor',
29
+ description: '既存ビルドアップ係数の設定を更新します',
30
+ inputSchema: {
31
+ type: 'object',
32
+ properties: {
33
+ material: {
34
+ type: 'string',
35
+ description: '更新する材料名'
36
+ },
37
+ use_slant_correction: {
38
+ type: 'boolean',
39
+ description: '新しいスラント補正設定'
40
+ },
41
+ use_finite_medium_correction: {
42
+ type: 'boolean',
43
+ description: '新しい有限媒体補正設定'
44
+ }
45
+ },
46
+ required: ['material']
47
+ }
48
+ },
49
+ {
50
+ name: 'poker_deleteBuildupFactor',
51
+ description: 'ビルドアップ係数を削除します',
52
+ inputSchema: {
53
+ type: 'object',
54
+ properties: {
55
+ material: {
56
+ type: 'string',
57
+ description: '削除する材料名'
58
+ }
59
+ },
60
+ required: ['material']
61
+ }
62
+ },
63
+ {
64
+ name: 'poker_changeOrderBuildupFactor',
65
+ description: 'ビルドアップ係数の順序を変更します',
66
+ inputSchema: {
67
+ type: 'object',
68
+ properties: {
69
+ material: {
70
+ type: 'string',
71
+ description: '順序を変更する材料名'
72
+ },
73
+ newIndex: {
74
+ type: 'integer',
75
+ description: '新しいインデックス位置',
76
+ minimum: 0
77
+ }
78
+ },
79
+ required: ['material', 'newIndex']
80
+ }
81
+ }
82
+ ];
@@ -0,0 +1,58 @@
1
+ // mcp/tools/calculationTools.js
2
+ export const calculationTools = [
3
+ {
4
+ name: 'poker_executeCalculation',
5
+ description: '作成したYAMLファイルを使用してpoker_cuiで放射線遮蔽計算を実行します',
6
+ inputSchema: {
7
+ type: 'object',
8
+ properties: {
9
+ yaml_file: {
10
+ type: 'string',
11
+ description: '計算に使用するYAMLファイル名(拡張子.yamlを含む)',
12
+ pattern: '^[a-zA-Z0-9_\\-\\.]+\\.(yaml|yml)$'
13
+ },
14
+ summary_options: {
15
+ type: 'object',
16
+ description: 'サマリー出力オプション(注意: show_source_dataとshow_total_doseの少なくとも一方は必須です)',
17
+ properties: {
18
+ show_parameters: {
19
+ type: 'boolean',
20
+ description: '入力パラメータをサマリーに表示(-pオプション)',
21
+ default: false
22
+ },
23
+ show_source_data: {
24
+ type: 'boolean',
25
+ description: '各線源による計算データ及び線量をサマリーに表示(-sオプション)',
26
+ default: true
27
+ },
28
+ show_total_dose: {
29
+ type: 'boolean',
30
+ description: '各検出器に対する全線源からの総和線量をサマリーに表示(-tオプション)',
31
+ default: true
32
+ }
33
+ },
34
+ additionalProperties: false
35
+ },
36
+ output_files: {
37
+ type: 'object',
38
+ description: '出力ファイル指定(入力YAMLファイルと同じフォルダに自動作成、全てYAML形式)',
39
+ properties: {
40
+ summary_file: {
41
+ type: 'string',
42
+ description: '出力サマリーファイル名(-oオプション、ファイル名のみ指定、自動的に入力ファイルと同じディレクトリに配置)',
43
+ pattern: '^[a-zA-Z0-9_\\-\\.]+\\.(yaml|yml)$'
44
+ },
45
+ dose_file: {
46
+ type: 'string',
47
+ description: '線量ファイル名(-dオプション、ファイル名のみ指定、自動的に入力ファイルと同じディレクトリに配置)',
48
+ pattern: '^[a-zA-Z0-9_\\-\\.]+\\.(yaml|yml)$'
49
+ }
50
+ },
51
+ additionalProperties: false
52
+ }
53
+ },
54
+ required: ['yaml_file'],
55
+ additionalProperties: false
56
+ }
57
+ }
58
+ ];
@@ -0,0 +1,22 @@
1
+ // mcp/tools/commonTools.js
2
+ export const commonTools = [
3
+ {
4
+ name: 'poker_applyChanges',
5
+ description: '保留中の全変更を実際のYAMLファイルに適用します(自動バックアップ実行)',
6
+ inputSchema: {
7
+ type: 'object',
8
+ properties: {
9
+ force: {
10
+ type: 'boolean',
11
+ description: '強制適用フラグ(警告を無視)',
12
+ default: false
13
+ },
14
+ backup_comment: {
15
+ type: 'string',
16
+ description: 'バックアップのコメント',
17
+ maxLength: 200
18
+ }
19
+ }
20
+ }
21
+ }
22
+ ];