@vint.tri/report_gen_mcp 1.7.2 → 1.7.3

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.
@@ -500,9 +500,9 @@
500
500
 
501
501
  ### Изображения, сгенерированные с помощью generate-image (Chutes AI)
502
502
 
503
- При использовании инструмента `generate-image` для генерации изображений с помощью Chutes AI, важно правильно форматировать параметры. Все числовые параметры должны быть представлены как числа, а не как строки.
503
+ При использовании инструмента `generate-image` для генерации изображений с помощью Chutes AI, числовые параметры могут быть представлены как числа или как строки. Инструмент автоматически преобразует строковые параметры в числа.
504
504
 
505
- ПРАВИЛЬНО (числовые параметры как числа):
505
+ ПРИМЕР 1 (числовые параметры как числа):
506
506
  ```json
507
507
  {
508
508
  "method": "tools/call",
@@ -521,7 +521,7 @@
521
521
  }
522
522
  ```
523
523
 
524
- НЕПРАВИЛЬНО (числовые параметры как строки):
524
+ ПРИМЕР 2 (числовые параметры как строки):
525
525
  ```json
526
526
  {
527
527
  "method": "tools/call",
@@ -540,7 +540,26 @@
540
540
  }
541
541
  ```
542
542
 
543
- **ВАЖНО:** Все числовые параметры (`width`, `height`, `guidance_scale`, `num_inference_steps`, `seed`) должны быть представлены как числа, а не как строки в кавычках. Это критически важно для корректной работы инструмента.
543
+ ПРИМЕР 3 (смешанные параметры):
544
+ ```json
545
+ {
546
+ "method": "tools/call",
547
+ "params": {
548
+ "name": "generate-image",
549
+ "arguments": {
550
+ "prompt": "a dog made of US dollar bills",
551
+ "width": "512",
552
+ "height": 512,
553
+ "guidance_scale": "7.5",
554
+ "negative_prompt": "blurry, low quality",
555
+ "num_inference_steps": 50,
556
+ "seed": "0"
557
+ }
558
+ }
559
+ }
560
+ ```
561
+
562
+ **Гибкость параметров:** Инструмент поддерживает как числовые, так и строковые значения для числовых параметров (`width`, `height`, `guidance_scale`, `num_inference_steps`, `seed`). Это обеспечивает совместимость с различными способами формирования запросов.
544
563
 
545
564
  ### Изображения по URL
546
565
 
@@ -479,6 +479,69 @@
479
479
  }
480
480
  ```
481
481
 
482
+ ### Изображения, сгенерированные с помощью generate-image (Chutes AI)
483
+
484
+ При использовании инструмента `generate-image` для генерации изображений с помощью Chutes AI, числовые параметры могут быть представлены как числа или как строки. Инструмент автоматически преобразует строковые параметры в числа.
485
+
486
+ ✅ ПРИМЕР 1 (числовые параметры как числа):
487
+ ```json
488
+ {
489
+ "method": "tools/call",
490
+ "params": {
491
+ "name": "generate-image",
492
+ "arguments": {
493
+ "prompt": "a dog made of US dollar bills",
494
+ "width": 512,
495
+ "height": 512,
496
+ "guidance_scale": 7.5,
497
+ "negative_prompt": "blurry, low quality",
498
+ "num_inference_steps": 50,
499
+ "seed": 0
500
+ }
501
+ }
502
+ }
503
+ ```
504
+
505
+ ✅ ПРИМЕР 2 (числовые параметры как строки):
506
+ ```json
507
+ {
508
+ "method": "tools/call",
509
+ "params": {
510
+ "name": "generate-image",
511
+ "arguments": {
512
+ "prompt": "a dog made of US dollar bills",
513
+ "width": "512",
514
+ "height": "512",
515
+ "guidance_scale": "7.5",
516
+ "negative_prompt": "blurry, low quality",
517
+ "num_inference_steps": "50",
518
+ "seed": "0"
519
+ }
520
+ }
521
+ }
522
+ ```
523
+
524
+ ✅ ПРИМЕР 3 (смешанные параметры):
525
+ ```json
526
+ {
527
+ "method": "tools/call",
528
+ "params": {
529
+ "name": "generate-image",
530
+ "arguments": {
531
+ "prompt": "a dog made of US dollar bills",
532
+ "width": "512",
533
+ "height": 512,
534
+ "guidance_scale": "7.5",
535
+ "negative_prompt": "blurry, low quality",
536
+ "num_inference_steps": 50,
537
+ "seed": "0"
538
+ }
539
+ }
540
+ }
541
+ ```
542
+
543
+ **Гибкость параметров:** Инструмент поддерживает как числовые, так и строковые значения для числовых параметров (`width`, `height`, `guidance_scale`, `num_inference_steps`, `seed`). Это обеспечивает совместимость с различными способами формирования запросов.
544
+
482
545
  ### Изображения по URL
483
546
 
484
547
  ```json
@@ -0,0 +1,35 @@
1
+ # Publication Confirmation - Version 1.7.0
2
+
3
+ ## Release Details
4
+ - **Version:** 1.7.0
5
+ - **Release Date:** September 2, 2025
6
+ - **Status:** Published
7
+
8
+ ## Summary
9
+ Version 1.7.0 has been successfully published. This release focuses on improving the robustness of the image generation tools by fixing parameter validation issues that were causing errors when the neural network sent numeric parameters as strings.
10
+
11
+ ## Key Improvements
12
+ 1. **String Parameter Validation Fix** - Updated Zod schema validation to accept both numbers and strings for numeric parameters in image generation tools
13
+ 2. **Enhanced Neural Network Compatibility** - The neural network can now send parameters as strings without errors
14
+ 3. **Backward Compatibility Maintained** - Existing code that sends numeric parameters continues to work
15
+ 4. **Flexible Input Handling** - Supports mixed parameter types (some as numbers, some as strings)
16
+
17
+ ## Files Updated
18
+ - `src/mcp/imageGenerationServer.ts` - Core fix implementation
19
+ - `dist/mcp/imageGenerationServer.js` - Compiled version
20
+ - `NEURAL_NETWORK_INSTRUCTIONS.md` - Documentation updates
21
+ - `FIXED_NEURAL_NETWORK_INSTRUCTIONS_v1.6.5.md` - Documentation updates
22
+ - `package.json` - Version bump to 1.7.0
23
+
24
+ ## Testing
25
+ All comprehensive tests pass successfully, confirming the fix resolves the original issue while maintaining full backward compatibility:
26
+ - String parameters test ✓
27
+ - Mixed parameters test ✓
28
+ - Numeric parameters test (backward compatibility) ✓
29
+ - Schema validation test ✓
30
+
31
+ ## Impact
32
+ This release eliminates frustrating validation errors that were preventing image generation, significantly improving the user experience while maintaining full backward compatibility.
33
+
34
+ ## Next Steps
35
+ No immediate action required. The fix is backward compatible and will automatically benefit all users of the image generation tools.
@@ -0,0 +1,97 @@
1
+ # String Parameter Validation Fix for Image Generation Tools
2
+
3
+ ## Problem Description
4
+
5
+ The neural network was sending numeric parameters as strings to the `generate-image` and `generate-image-to-file` tools, causing validation errors:
6
+
7
+ ```
8
+ Error calling tool generate-image: Error: Error invoking remote method 'mcp:call-tool': McpError: MCP error -32602: Invalid arguments for tool generate-image: [
9
+ {
10
+ "code": "invalid_type",
11
+ "expected": "number",
12
+ "received": "string",
13
+ "path": ["width"],
14
+ "message": "Expected number, received string"
15
+ },
16
+ // Similar errors for height, guidance_scale, num_inference_steps, seed
17
+ ]
18
+ ```
19
+
20
+ ## Root Cause
21
+
22
+ The Zod schema validation in the MCP server expected actual numbers for numeric parameters, but the neural network was sending them as JSON strings:
23
+
24
+ ```json
25
+ {
26
+ "params": {
27
+ "prompt": "a dog made of dollar bills",
28
+ "width": "512",
29
+ "height": "512",
30
+ "guidance_scale": "7.5",
31
+ "negative_prompt": "blurry, low quality",
32
+ "num_inference_steps": "50",
33
+ "seed": "0"
34
+ }
35
+ }
36
+ ```
37
+
38
+ The validation was happening at the MCP framework level before the conversion logic in our handler could run.
39
+
40
+ ## Solution Implemented
41
+
42
+ ### 1. Updated Zod Schema Validation
43
+
44
+ Modified the input schema for both `generate_image` and `generate_image_to_file` tools in `src/mcp/imageGenerationServer.ts` to accept both numbers and strings:
45
+
46
+ ```typescript
47
+ // Before (only accepted numbers)
48
+ width: z.number().optional().describe("Ширина изображения (128-2048)"),
49
+
50
+ // After (accepts both numbers and strings)
51
+ width: z.union([z.number(), z.string()]).optional().describe("Ширина изображения (128-2048)"),
52
+ ```
53
+
54
+ This change was applied to all numeric parameters:
55
+ - `width`
56
+ - `height`
57
+ - `guidance_scale`
58
+ - `num_inference_steps`
59
+ - `seed`
60
+
61
+ ### 2. Maintained Existing Conversion Logic
62
+
63
+ The existing parameter conversion logic in the handler functions was already correctly implemented and continues to work:
64
+
65
+ ```typescript
66
+ // Преобразуем строковые значения в числа, если необходимо
67
+ const generationParams: Partial<ImageGenerationSettings> = {};
68
+ if (args.width !== undefined) {
69
+ generationParams.width = typeof args.width === 'string' ? parseFloat(args.width) : args.width;
70
+ }
71
+ // ... similar for other parameters
72
+ ```
73
+
74
+ ## Benefits
75
+
76
+ 1. **Neural Network Compatibility**: The neural network can now send parameters as strings without errors
77
+ 2. **Backward Compatibility**: Existing code that sends numeric parameters continues to work
78
+ 3. **Flexible Input Handling**: Supports mixed parameter types (some as numbers, some as strings)
79
+ 4. **Robust Error Handling**: Proper validation and conversion with appropriate error messages
80
+
81
+ ## Testing
82
+
83
+ Created comprehensive tests to verify the fix works correctly:
84
+
85
+ 1. **String Parameters Test**: Verifies that string parameters are accepted and converted correctly
86
+ 2. **Mixed Parameters Test**: Ensures mixed parameter types (numbers and strings) work properly
87
+ 3. **Numeric Parameters Test**: Confirms backward compatibility with all numeric parameters
88
+ 4. **Validation Test**: Tests that the Zod schema correctly validates different parameter combinations
89
+
90
+ ## Files Modified
91
+
92
+ - `src/mcp/imageGenerationServer.ts` - Updated Zod schema validation
93
+ - `dist/mcp/imageGenerationServer.js` - Compiled version (automatically generated)
94
+
95
+ ## Impact
96
+
97
+ This fix resolves the issue where neural networks sending string-formatted numeric parameters would receive validation errors, allowing seamless image generation with the Chutes AI service while maintaining full backward compatibility.
@@ -0,0 +1,126 @@
1
+ # Version 1.7.0 Release Notes
2
+
3
+ ## Overview
4
+
5
+ This release focuses on improving the robustness of the image generation tools by fixing parameter validation issues that were causing errors when the neural network sent numeric parameters as strings.
6
+
7
+ ## Key Changes
8
+
9
+ ### String Parameter Validation Fix for Image Generation Tools
10
+
11
+ **Problem:** The neural network was sending numeric parameters as strings to the `generate-image` and `generate-image-to-file` tools, causing validation errors:
12
+
13
+ ```
14
+ Error calling tool generate-image: Error: Error invoking remote method 'mcp:call-tool': McpError: MCP error -32602: Invalid arguments for tool generate-image: [
15
+ {
16
+ "code": "invalid_type",
17
+ "expected": "number",
18
+ "received": "string",
19
+ "path": ["width"],
20
+ "message": "Expected number, received string"
21
+ },
22
+ // Similar errors for height, guidance_scale, num_inference_steps, seed
23
+ ]
24
+ ```
25
+
26
+ **Solution:** Updated the Zod schema validation in `src/mcp/imageGenerationServer.ts` to accept both numbers and strings for numeric parameters, with automatic conversion to numbers in the implementation layer.
27
+
28
+ ### Files Modified
29
+
30
+ 1. `src/mcp/imageGenerationServer.ts` - Updated Zod schema validation for both `generate_image` and `generate_image_to_file` tools
31
+ 2. `dist/mcp/imageGenerationServer.js` - Compiled version (automatically generated)
32
+ 3. `NEURAL_NETWORK_INSTRUCTIONS.md` - Updated documentation to reflect the flexibility in parameter formats
33
+ 4. `FIXED_NEURAL_NETWORK_INSTRUCTIONS_v1.6.5.md` - Updated documentation with examples of different parameter formats
34
+
35
+ ### Benefits
36
+
37
+ 1. **Neural Network Compatibility**: The neural network can now send parameters as strings without errors
38
+ 2. **Backward Compatibility**: Existing code that sends numeric parameters continues to work
39
+ 3. **Flexible Input Handling**: Supports mixed parameter types (some as numbers, some as strings)
40
+ 4. **Improved User Experience**: Eliminates frustrating validation errors that were preventing image generation
41
+
42
+ ### Testing
43
+
44
+ Created comprehensive tests to verify the fix works correctly:
45
+ - String parameters test
46
+ - Mixed parameters test
47
+ - Numeric parameters test (backward compatibility)
48
+ - Schema validation test
49
+
50
+ All tests pass successfully, confirming the fix resolves the original issue while maintaining full backward compatibility.
51
+
52
+ ## How to Upgrade
53
+
54
+ To upgrade to version 1.7.0, simply update your package and rebuild:
55
+
56
+ ```bash
57
+ npm install
58
+ npm run build
59
+ ```
60
+
61
+ The fix is backward compatible, so no code changes are required in existing implementations.
62
+
63
+ ## Documentation Updates
64
+
65
+ Updated neural network instructions now clearly explain that numeric parameters can be sent as either numbers or strings:
66
+
67
+ ✅ PREFERRED FORMAT (numbers):
68
+ ```json
69
+ {
70
+ "method": "tools/call",
71
+ "params": {
72
+ "name": "generate-image",
73
+ "arguments": {
74
+ "prompt": "a dog made of US dollar bills",
75
+ "width": 512,
76
+ "height": 512,
77
+ "guidance_scale": 7.5,
78
+ "negative_prompt": "blurry, low quality",
79
+ "num_inference_steps": 50,
80
+ "seed": 0
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ ✅ ALTERNATIVE FORMAT (strings):
87
+ ```json
88
+ {
89
+ "method": "tools/call",
90
+ "params": {
91
+ "name": "generate-image",
92
+ "arguments": {
93
+ "prompt": "a dog made of US dollar bills",
94
+ "width": "512",
95
+ "height": "512",
96
+ "guidance_scale": "7.5",
97
+ "negative_prompt": "blurry, low quality",
98
+ "num_inference_steps": "50",
99
+ "seed": "0"
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ ✅ MIXED FORMAT:
106
+ ```json
107
+ {
108
+ "method": "tools/call",
109
+ "params": {
110
+ "name": "generate-image",
111
+ "arguments": {
112
+ "prompt": "a dog made of US dollar bills",
113
+ "width": "512",
114
+ "height": 512,
115
+ "guidance_scale": "7.5",
116
+ "negative_prompt": "blurry, low quality",
117
+ "num_inference_steps": 50,
118
+ "seed": "0"
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ ## Impact
125
+
126
+ This fix resolves the issue where neural networks sending string-formatted numeric parameters would receive validation errors, allowing seamless image generation with the Chutes AI service while maintaining full backward compatibility.
package/dist/index.js CHANGED
@@ -103,7 +103,7 @@ if (process.argv.length === 2) {
103
103
  // No command specified, run in stdio mode using MCP SDK
104
104
  const mcpServer = new McpServer({
105
105
  name: "report_gen_mcp",
106
- version: "1.7.2"
106
+ version: "1.7.3"
107
107
  }, {
108
108
  // Disable health check to prevent automatic calls
109
109
  capabilities: {
@@ -106,12 +106,12 @@ app.registerTool("generate_image", {
106
106
  description: "Генерирует изображения. ВАЖНО: промпт и негативный промпт должны быть СТРОГО на английском языке!",
107
107
  inputSchema: {
108
108
  prompt: z.string().describe("Текстовый промпт для генерации изображения НА АНГЛИЙСКОМ ЯЗЫКЕ"),
109
- width: z.number().optional().describe("Ширина изображения (128-2048)"),
110
- height: z.number().optional().describe("Высота изображения (128-2048)"),
111
- guidance_scale: z.number().optional().describe("Сила следования промпту (1.0-20.0)"),
109
+ width: z.union([z.number(), z.string()]).optional().describe("Ширина изображения (128-2048)"),
110
+ height: z.union([z.number(), z.string()]).optional().describe("Высота изображения (128-2048)"),
111
+ guidance_scale: z.union([z.number(), z.string()]).optional().describe("Сила следования промпту (1.0-20.0)"),
112
112
  negative_prompt: z.string().optional().describe("Негативный промпт (что НЕ включать в изображение)"),
113
- num_inference_steps: z.number().optional().describe("Количество шагов генерации (1-50)"),
114
- seed: z.number().optional().describe("Seed для воспроизводимости (0 = случайный)")
113
+ num_inference_steps: z.union([z.number(), z.string()]).optional().describe("Количество шагов генерации (1-50)"),
114
+ seed: z.union([z.number(), z.string()]).optional().describe("Seed для воспроизводимости (0 = случайный)")
115
115
  },
116
116
  }, async (args) => {
117
117
  try {
@@ -199,12 +199,12 @@ app.registerTool("generate_image_to_file", {
199
199
  prompt: z.string().describe("Текстовый промпт для генерации изображения НА АНГЛИЙСКОМ ЯЗЫКЕ"),
200
200
  directory: z.string().describe("Каталог для сохранения изображения"),
201
201
  filename: z.string().describe("Имя файла для сохранения (с расширением)"),
202
- width: z.number().optional().describe("Ширина изображения (128-2048)"),
203
- height: z.number().optional().describe("Высота изображения (128-2048)"),
204
- guidance_scale: z.number().optional().describe("Сила следования промпту (1.0-20.0)"),
202
+ width: z.union([z.number(), z.string()]).optional().describe("Ширина изображения (128-2048)"),
203
+ height: z.union([z.number(), z.string()]).optional().describe("Высота изображения (128-2048)"),
204
+ guidance_scale: z.union([z.number(), z.string()]).optional().describe("Сила следования промпту (1.0-20.0)"),
205
205
  negative_prompt: z.string().optional().describe("Негативный промпт (что НЕ включать в изображение)"),
206
- num_inference_steps: z.number().optional().describe("Количество шагов генерации (1-50)"),
207
- seed: z.number().optional().describe("Seed для воспроизводимости (0 = случайный)")
206
+ num_inference_steps: z.union([z.number(), z.string()]).optional().describe("Количество шагов генерации (1-50)"),
207
+ seed: z.union([z.number(), z.string()]).optional().describe("Seed для воспроизводимости (0 = случайный)")
208
208
  },
209
209
  }, async (args) => {
210
210
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vint.tri/report_gen_mcp",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "CLI tool for generating HTML reports with embedded charts and images",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/publish.sh CHANGED
@@ -1,45 +1,12 @@
1
1
  #!/bin/bash
2
2
 
3
- # Script to publish @vint.tri/report_gen_mcp package version 1.6.9
3
+ # Exit immediately if a command exits with a non-zero status.
4
+ set -e
4
5
 
5
- echo "Publishing @vint.tri/report_gen_mcp version 1.6.9"
6
-
7
- # Check if we're logged into npm
8
- echo "Checking npm login status..."
9
- npm whoami
10
-
11
- if [ $? -ne 0 ]; then
12
- echo "Error: Not logged into npm. Please run 'npm login' first."
13
- exit 1
14
- fi
15
-
16
- # Check current version
17
- echo "Checking current package version..."
18
- CURRENT_VERSION=$(node -p "require('./package.json').version")
19
- echo "Current version: $CURRENT_VERSION"
20
-
21
- if [ "$CURRENT_VERSION" != "1.6.9" ]; then
22
- echo "Error: Package version is not 1.6.9. Please update package.json first."
23
- exit 1
24
- fi
25
-
26
- # Run build to ensure we have the latest compiled files
27
- echo "Building project..."
6
+ echo "Building the project..."
28
7
  npm run build
29
8
 
30
- if [ $? -ne 0 ]; then
31
- echo "Error: Build failed. Please fix build issues before publishing."
32
- exit 1
33
- fi
34
-
35
- # Publish to npm
36
- echo "Publishing to npm..."
9
+ echo "Publishing the package to npm..."
37
10
  npm publish --access public
38
11
 
39
- if [ $? -eq 0 ]; then
40
- echo "Successfully published @vint.tri/report_gen_mcp version 1.6.9"
41
- echo "You can now install it using: npm install @vint.tri/report_gen_mcp@1.6.9"
42
- else
43
- echo "Error: Failed to publish package"
44
- exit 1
45
- fi
12
+ echo "Publication complete."