ultimate-gemini-mcp 1.0.2__tar.gz → 1.0.3__tar.gz

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.

Potentially problematic release.


This version of ultimate-gemini-mcp might be problematic. Click here for more details.

Files changed (31) hide show
  1. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/PKG-INFO +1 -1
  2. ultimate_gemini_mcp-1.0.3/TEST_RESULTS.md +472 -0
  3. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/pyproject.toml +1 -1
  4. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/__init__.py +1 -1
  5. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/services/gemini_client.py +27 -3
  6. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/services/imagen_client.py +6 -1
  7. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/tools/generate_image.py +14 -1
  8. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/.env.example +0 -0
  9. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/.github/workflows/README.md +0 -0
  10. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/.github/workflows/claude-code-review.yml +0 -0
  11. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/.github/workflows/claude.yml +0 -0
  12. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/.github/workflows/publish.yml +0 -0
  13. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/.github/workflows/test.yml +0 -0
  14. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/.gitignore +0 -0
  15. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/CLAUDE.md +0 -0
  16. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/LICENSE +0 -0
  17. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/MANIFEST.in +0 -0
  18. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/PUBLISHING.md +0 -0
  19. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/README.md +0 -0
  20. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/config/__init__.py +0 -0
  21. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/config/constants.py +0 -0
  22. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/config/settings.py +0 -0
  23. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/core/__init__.py +0 -0
  24. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/core/exceptions.py +0 -0
  25. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/core/validation.py +0 -0
  26. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/server.py +0 -0
  27. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/services/__init__.py +0 -0
  28. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/services/image_service.py +0 -0
  29. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/services/prompt_enhancer.py +0 -0
  30. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/tools/__init__.py +0 -0
  31. {ultimate_gemini_mcp-1.0.2 → ultimate_gemini_mcp-1.0.3}/src/tools/batch_generate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultimate-gemini-mcp
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Ultimate image generation MCP server unifying Gemini 2.5 Flash Image and Imagen 4/Fast/Ultra with advanced features
5
5
  Project-URL: Homepage, https://github.com/anand-92/ultimate-image-gen-mcp
6
6
  Project-URL: Repository, https://github.com/anand-92/ultimate-image-gen-mcp
@@ -0,0 +1,472 @@
1
+ # Ultimate Gemini MCP Server - Test Results
2
+
3
+ **Test Date:** October 25, 2025
4
+ **Tester:** Claude Code
5
+ **Version:** Post JSON fix (commit 00a29ce)
6
+
7
+ ## Executive Summary
8
+
9
+ The MCP server was thoroughly tested across multiple dimensions. **Imagen models work flawlessly**, while **Gemini 2.5 Flash Image has a critical issue** preventing image generation.
10
+
11
+ ### Quick Status
12
+ - ✅ Imagen-4, Imagen-4-Fast, Imagen-4-Ultra: **WORKING**
13
+ - ❌ Gemini-2.5-Flash-Image: **BROKEN**
14
+ - ✅ Prompt enhancement: **WORKING**
15
+ - ✅ Aspect ratios: **WORKING**
16
+ - ✅ Input validation: **WORKING**
17
+ - ⚠️ Seed parameter: **NOT SUPPORTED BY API**
18
+
19
+ ---
20
+
21
+ ## Test Results by Category
22
+
23
+ ### 1. Basic Image Generation
24
+
25
+ #### ✅ Imagen Models (ALL WORKING)
26
+
27
+ **Imagen-4**
28
+ - Status: ✅ PASS
29
+ - Test: Generated "beautiful sunset over mountains"
30
+ - Result: Successfully generated 1.4MB PNG image
31
+ - Enhanced prompt: Working correctly (very detailed enhancement)
32
+ - Output path: `generated_images/imagen-4_20251025_184107_a beautiful sunset over mountains.png`
33
+
34
+ **Imagen-4-Fast**
35
+ - Status: ✅ PASS
36
+ - Test: Generated "serene japanese garden"
37
+ - Result: Successfully generated 2.0MB PNG image
38
+ - Performance: Fast generation (9-10 seconds)
39
+ - Output path: `generated_images/imagen-4-fast_20251025_184117_a serene japanese garden.png`
40
+
41
+ **Imagen-4-Ultra**
42
+ - Status: ✅ PASS
43
+ - Test: Generated "abstract geometric art"
44
+ - Result: Successfully generated 1.0MB PNG image
45
+ - Quality: Excellent detail and clarity
46
+ - Output path: `generated_images/imagen-4-ultra_20251025_184130_abstract geometric art.png`
47
+
48
+ #### ❌ Gemini 2.5 Flash Image (BROKEN)
49
+
50
+ **Test 1: Basic generation**
51
+ - Status: ❌ FAIL
52
+ - Test: "a futuristic robot in a neon-lit cyberpunk city"
53
+ - Error: `Gemini API request failed: No image data found in Gemini API response`
54
+ - Details: API returns response but image extraction fails
55
+
56
+ **Test 2: Simple prompt without enhancement**
57
+ - Status: ❌ FAIL
58
+ - Test: "a simple red apple on a wooden table" (enhance_prompt=false)
59
+ - Error: Same as Test 1
60
+ - Details: Issue persists even without prompt enhancement
61
+
62
+ **Root Cause:** The Gemini API is being called successfully (no authentication or network errors), but the response parsing logic in `_extract_images()` is not finding image data in the response structure. This suggests either:
63
+ 1. The API response format has changed
64
+ 2. The API is not returning images in the expected format
65
+ 3. There's a quota/capability issue with the API key
66
+
67
+ ---
68
+
69
+ ### 2. Aspect Ratios
70
+
71
+ #### ✅ All Aspect Ratios Working (Imagen)
72
+
73
+ | Aspect Ratio | Status | Test Prompt | File Size | Notes |
74
+ |--------------|--------|-------------|-----------|-------|
75
+ | 16:9 | ✅ PASS | "wide panoramic landscape" | 1.9MB | Correctly wide format |
76
+ | 9:16 | ✅ PASS | "tall portrait of a tree" | 1.9MB | Correctly vertical |
77
+ | 4:3 | ✅ PASS | "classic photograph composition" | 1.4MB | Classic format |
78
+ | 1:1 | ✅ PASS | Multiple tests | 1.0-2.0MB | Default, works perfectly |
79
+
80
+ **Finding:** All standard aspect ratios are correctly applied to generated images.
81
+
82
+ ---
83
+
84
+ ### 3. Prompt Enhancement
85
+
86
+ #### ✅ Enhancement Toggle Working
87
+
88
+ **With Enhancement (enhance_prompt=true)**
89
+ - Status: ✅ PASS
90
+ - Original: "a beautiful sunset over mountains"
91
+ - Enhanced: "A breathtaking, hyperrealistic cinematic panorama of massive, jagged alpine peaks at the climax of sunset..."
92
+ - Length: Enhanced prompts are ~10x longer with detailed photography terms
93
+ - Quality: Significantly improves output with cinematic, technical details
94
+
95
+ **Without Enhancement (enhance_prompt=false)**
96
+ - Status: ✅ PASS
97
+ - Original: "a red apple on a table"
98
+ - Enhanced: "a red apple on a table" (unchanged)
99
+ - Finding: When disabled, original prompt is preserved exactly
100
+
101
+ **Enhancement Quality Examples:**
102
+ - Adds photography terms: "Golden Hour", "bokeh", "HDR", "volumetric lighting"
103
+ - Specifies composition: "rule of thirds", "leading lines", "chiaroscuro"
104
+ - Defines technical details: "f/16 aperture", "8K resolution", "medium format"
105
+
106
+ ---
107
+
108
+ ### 4. Gemini Image Editing
109
+
110
+ #### ❌ Image Editing Not Working
111
+
112
+ **Test 1: Add red border**
113
+ - Status: ❌ FAIL
114
+ - Input: `thisimage.png`
115
+ - Prompt: "add a red border around this image"
116
+ - Error: `Gemini API request failed: No image data found in Gemini API response`
117
+
118
+ **Test 2: Brighten image**
119
+ - Status: ❌ FAIL
120
+ - Input: `thisOnetoo.png`
121
+ - Prompt: "make this image brighter"
122
+ - Error: Same as Test 1
123
+
124
+ **Finding:** Image editing failures are consistent with base Gemini generation failures. The issue is in the API response handling, not specific to editing.
125
+
126
+ ---
127
+
128
+ ### 5. Gemini-Specific Features
129
+
130
+ All tests failed due to the underlying Gemini API issue.
131
+
132
+ #### ❌ Character Consistency (NOT TESTED - API BROKEN)
133
+ - Status: ❌ FAIL
134
+ - Test: `maintain_character_consistency=true`
135
+ - Error: `No image data found in Gemini API response`
136
+
137
+ #### ❌ World Knowledge (NOT TESTED - API BROKEN)
138
+ - Status: ❌ FAIL
139
+ - Test: `use_world_knowledge=true`
140
+ - Error: `No image data found in Gemini API response`
141
+
142
+ #### ❌ Image Blending (NOT TESTED - API BROKEN)
143
+ - Not tested due to base API failure
144
+
145
+ **Note:** These features cannot be properly tested until the Gemini API response parsing is fixed.
146
+
147
+ ---
148
+
149
+ ### 6. Imagen-Specific Features
150
+
151
+ #### ✅ Negative Prompt Working
152
+
153
+ **Test: Exclude elements from landscape**
154
+ - Status: ✅ PASS
155
+ - Prompt: "a beautiful landscape"
156
+ - Negative: "people, buildings, cars, urban"
157
+ - Result: Generated pure nature landscape without excluded elements
158
+ - File size: 1.6MB
159
+ - Finding: Negative prompts are correctly applied
160
+
161
+ #### ❌ Seed Parameter NOT SUPPORTED
162
+
163
+ **Test: Reproducible generation with seed**
164
+ - Status: ❌ FAIL (API limitation)
165
+ - Seed: 12345
166
+ - Error: `Setting seed is not supported.` (HTTP 400)
167
+ - API Response:
168
+ ```json
169
+ {
170
+ "error": {
171
+ "code": 400,
172
+ "message": "Setting seed is not supported.",
173
+ "status": "INVALID_ARGUMENT"
174
+ }
175
+ }
176
+ ```
177
+
178
+ **CRITICAL FINDING:** The Imagen API does NOT support the seed parameter, despite it being documented in the tool. This is an API limitation, not a server bug.
179
+
180
+ **Recommendation:** Either:
181
+ 1. Remove seed parameter from tool definition
182
+ 2. Add clear documentation that seed is not supported
183
+ 3. Silently ignore seed parameter instead of passing to API
184
+
185
+ #### ⚠️ Person Generation Policy
186
+
187
+ **Test 1: Allow adults**
188
+ - Status: ✅ PASS
189
+ - Setting: `person_generation=allow_adult`
190
+ - Prompt: "a person walking in a park"
191
+ - Result: Successfully generated image with person
192
+
193
+ **Test 2: Don't allow people**
194
+ - Status: ⚠️ PARTIAL FAIL
195
+ - Setting: `person_generation=dont_allow`
196
+ - Prompt: "a crowd of people"
197
+ - Error: `No image data found in Imagen API response`
198
+ - Finding: When prompt conflicts with policy, API appears to block generation
199
+
200
+ **Recommendation:** Add validation to warn users when prompt conflicts with person_generation policy.
201
+
202
+ ---
203
+
204
+ ### 7. Error Handling & Validation
205
+
206
+ #### ✅ Input Validation Working Correctly
207
+
208
+ **Invalid Model Name**
209
+ - Status: ✅ PASS
210
+ - Input: `model=invalid-model-name`
211
+ - Error: `Invalid model 'invalid-model-name'. Available models: gemini-2.5-flash-image, gemini-flash-latest, imagen-4, imagen-4-fast, imagen-4-ultra`
212
+ - Finding: Clear, helpful error message with available options
213
+
214
+ **Invalid Aspect Ratio**
215
+ - Status: ✅ PASS
216
+ - Input: `aspect_ratio=99:99`
217
+ - Error: `Invalid aspect ratio '99:99'. Available: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9`
218
+ - Finding: Validation catches invalid input before API call
219
+
220
+ **Error Response Format**
221
+ All errors return consistent JSON structure:
222
+ ```json
223
+ {
224
+ "success": false,
225
+ "error": "Error message",
226
+ "error_type": "ValidationError|APIError"
227
+ }
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Critical Issues
233
+
234
+ ### 🔴 ISSUE #1: Gemini 2.5 Flash Image Completely Broken
235
+
236
+ **Severity:** CRITICAL
237
+ **Impact:** All Gemini features unusable (generation, editing, character consistency, etc.)
238
+
239
+ **Error:** `Gemini API request failed: No image data found in Gemini API response`
240
+
241
+ **Affected Components:**
242
+ - Basic image generation
243
+ - Image editing with input images
244
+ - Character consistency feature
245
+ - World knowledge feature
246
+ - Image blending feature
247
+
248
+ **Reproducibility:** 100% - All Gemini tests failed consistently
249
+
250
+ **Probable Causes:**
251
+ 1. **Response format mismatch:** The `_extract_images()` method in `gemini_client.py:163-180` may not match the actual API response structure
252
+ 2. **API version change:** Google may have updated the response format
253
+ 3. **Missing capability:** API key might lack image generation permissions
254
+
255
+ **Recommended Investigation Steps:**
256
+ 1. Add debug logging to print the full API response in `gemini_client.py`
257
+ 2. Verify the response structure matches documentation at `ai.google.dev/gemini-api/docs`
258
+ 3. Check if the API returns images in a different field/format
259
+ 4. Test with a direct API call using curl to verify the API key works
260
+
261
+ **Suggested Code Fix Location:**
262
+ `src/services/gemini_client.py:163-180` - The `_extract_images()` method
263
+
264
+ ---
265
+
266
+ ### 🟡 ISSUE #2: Seed Parameter Not Supported by API
267
+
268
+ **Severity:** MEDIUM
269
+ **Impact:** Users cannot create reproducible images with Imagen
270
+
271
+ **Error:** `Setting seed is not supported.` (HTTP 400 from API)
272
+
273
+ **Current Behavior:**
274
+ - Tool accepts `seed` parameter
275
+ - Parameter is passed to Imagen API
276
+ - API rejects request with 400 error
277
+
278
+ **Recommended Fix:**
279
+ 1. Remove `seed` parameter from tool definition entirely, OR
280
+ 2. Add documentation warning that seed is not supported, OR
281
+ 3. Silently ignore seed parameter (don't pass to API)
282
+
283
+ **Code Location:**
284
+ - `src/tools/generate_image.py:42` - Parameter definition
285
+ - `src/tools/generate_image.py:126-127` - Parameter usage
286
+
287
+ ---
288
+
289
+ ### 🟡 ISSUE #3: Person Generation Policy Conflicts
290
+
291
+ **Severity:** LOW
292
+ **Impact:** Confusing error when prompt conflicts with policy
293
+
294
+ **Behavior:**
295
+ - When `person_generation=dont_allow` and prompt mentions people
296
+ - API returns empty response (no images)
297
+ - Error: `No image data found in Imagen API response`
298
+
299
+ **Recommended Fix:**
300
+ Add validation to warn users:
301
+ ```python
302
+ if person_generation == "dont_allow" and contains_person_keywords(prompt):
303
+ logger.warning("Prompt may conflict with person_generation policy")
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Working Features Summary
309
+
310
+ ### ✅ Fully Functional
311
+
312
+ 1. **Imagen-4 Image Generation** - Perfect quality, reliable
313
+ 2. **Imagen-4-Fast Generation** - Fast, high quality
314
+ 3. **Imagen-4-Ultra Generation** - Highest quality option
315
+ 4. **All Aspect Ratios** - 1:1, 16:9, 9:16, 4:3, etc. all work
316
+ 5. **Prompt Enhancement** - Excellent quality improvements
317
+ 6. **Enhancement Toggle** - Can enable/disable as needed
318
+ 7. **Negative Prompts** - Correctly excludes unwanted elements
319
+ 8. **Input Validation** - Catches errors before API calls
320
+ 9. **Error Messages** - Clear, actionable error reporting
321
+ 10. **Person Generation Policy** - Works when not conflicting with prompt
322
+
323
+ ### ❌ Not Working
324
+
325
+ 1. **All Gemini 2.5 Flash Image features** - Complete failure
326
+ 2. **Gemini Image Editing** - Cannot test due to #1
327
+ 3. **Seed Parameter** - Not supported by Imagen API
328
+
329
+ ### ⚠️ Partial/Untested
330
+
331
+ 1. **Character Consistency** - Cannot test (Gemini broken)
332
+ 2. **World Knowledge** - Cannot test (Gemini broken)
333
+ 3. **Image Blending** - Cannot test (Gemini broken)
334
+
335
+ ---
336
+
337
+ ## Performance Metrics
338
+
339
+ ### Generation Times (approximate)
340
+
341
+ | Model | Average Time | Notes |
342
+ |-------|--------------|-------|
343
+ | Imagen-4 | 12-15 seconds | Consistent performance |
344
+ | Imagen-4-Fast | 9-12 seconds | Noticeably faster |
345
+ | Imagen-4-Ultra | 15-20 seconds | Slowest but best quality |
346
+ | Gemini-2.5-Flash-Image | N/A | Not working |
347
+
348
+ ### File Sizes
349
+
350
+ | Format | Typical Range | Notes |
351
+ |--------|--------------|-------|
352
+ | PNG (Imagen-4) | 1.0-2.0 MB | Varies by complexity |
353
+ | PNG (Imagen-4-Ultra) | 1.5-2.5 MB | Larger due to quality |
354
+
355
+ ### Prompt Enhancement Overhead
356
+
357
+ - Time added: 2-5 seconds
358
+ - Quality improvement: Significant
359
+ - Enhanced prompt length: 5-10x original
360
+ - Worth it: **Yes** - dramatic quality increase
361
+
362
+ ---
363
+
364
+ ## Recommendations
365
+
366
+ ### Immediate Actions Required
367
+
368
+ 1. **Fix Gemini API Response Parsing** (CRITICAL)
369
+ - Debug the actual API response structure
370
+ - Update `_extract_images()` method
371
+ - Add comprehensive logging for debugging
372
+
373
+ 2. **Remove or Document Seed Parameter** (MEDIUM)
374
+ - Either remove from tool definition
375
+ - Or add clear warning in documentation
376
+
377
+ 3. **Add Person Policy Validation** (LOW)
378
+ - Warn when prompt conflicts with person_generation policy
379
+ - Improve error message clarity
380
+
381
+ ### Long-term Improvements
382
+
383
+ 1. **Add Comprehensive Logging**
384
+ - Log full API responses (in debug mode)
385
+ - Log request/response times
386
+ - Log image extraction process
387
+
388
+ 2. **Add Integration Tests**
389
+ - Test against real API (with mocked responses as fallback)
390
+ - Validate response parsing logic
391
+ - Test all parameter combinations
392
+
393
+ 3. **Improve Error Messages**
394
+ - Add specific troubleshooting steps
395
+ - Link to documentation
396
+ - Provide example working requests
397
+
398
+ 4. **Add Response Validation**
399
+ - Validate API response structure before parsing
400
+ - Provide clear errors when structure doesn't match
401
+ - Log unexpected response formats
402
+
403
+ ---
404
+
405
+ ## Test Coverage Summary
406
+
407
+ | Category | Tests Passed | Tests Failed | Coverage |
408
+ |----------|--------------|--------------|----------|
409
+ | Imagen Generation | 3/3 | 0/3 | 100% ✅ |
410
+ | Gemini Generation | 0/5 | 5/5 | 0% ❌ |
411
+ | Aspect Ratios | 4/4 | 0/4 | 100% ✅ |
412
+ | Prompt Enhancement | 2/2 | 0/2 | 100% ✅ |
413
+ | Image Editing | 0/2 | 2/2 | 0% ❌ |
414
+ | Imagen Features | 2/4 | 2/4 | 50% ⚠️ |
415
+ | Validation | 2/2 | 0/2 | 100% ✅ |
416
+ | **TOTAL** | **13/22** | **9/22** | **59%** |
417
+
418
+ ---
419
+
420
+ ## Conclusion
421
+
422
+ The Ultimate Gemini MCP server has a **solid foundation** with excellent Imagen support, but is **currently unusable for Gemini features**. The Imagen models work flawlessly with good error handling and validation.
423
+
424
+ **Priority:** Fix the Gemini API response parsing to unlock 41% of currently broken functionality.
425
+
426
+ **Overall Grade:** C+ (Would be A- if Gemini worked)
427
+
428
+ ---
429
+
430
+ ## Appendix: Example Outputs
431
+
432
+ ### Successful Imagen-4 Generation
433
+ ```json
434
+ {
435
+ "success": true,
436
+ "model": "imagen-4",
437
+ "prompt": "a beautiful sunset over mountains",
438
+ "images_generated": 1,
439
+ "images": [
440
+ {
441
+ "index": 0,
442
+ "size": 1427713,
443
+ "timestamp": "2025-10-25T18:41:07.844797",
444
+ "path": "generated_images/imagen-4_20251025_184107_a beautiful sunset over mountains.png",
445
+ "filename": "imagen-4_20251025_184107_a beautiful sunset over mountains.png",
446
+ "enhanced_prompt": "A breathtaking, hyperrealistic cinematic panorama..."
447
+ }
448
+ ],
449
+ "metadata": {
450
+ "enhance_prompt": true,
451
+ "aspect_ratio": "1:1"
452
+ }
453
+ }
454
+ ```
455
+
456
+ ### Failed Gemini Generation
457
+ ```json
458
+ {
459
+ "success": false,
460
+ "error": "Gemini API request failed: No image data found in Gemini API response",
461
+ "error_type": "APIError"
462
+ }
463
+ ```
464
+
465
+ ### Seed Not Supported Error
466
+ ```json
467
+ {
468
+ "success": false,
469
+ "error": "API request failed with status 400: {\n \"error\": {\n \"code\": 400,\n \"message\": \"Setting seed is not supported.\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}",
470
+ "error_type": "APIError"
471
+ }
472
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ultimate-gemini-mcp"
3
- version = "1.0.2"
3
+ version = "1.0.3"
4
4
  description = "Ultimate image generation MCP server unifying Gemini 2.5 Flash Image and Imagen 4/Fast/Ultra with advanced features"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -7,7 +7,7 @@ A unified MCP server that combines the best features from:
7
7
  - Advanced features: batch processing, editing, templates, and more
8
8
  """
9
9
 
10
- __version__ = "1.0.2"
10
+ __version__ = "1.0.3"
11
11
  __author__ = "Ultimate Gemini MCP"
12
12
 
13
13
  from .config import get_settings
@@ -83,7 +83,21 @@ class GeminiClient:
83
83
 
84
84
  parts.append({"text": prompt_text})
85
85
 
86
- request_body = {"contents": [{"parts": parts}]}
86
+ # Build generation config for image generation
87
+ generation_config = {
88
+ "responseModalities": ["Image"]
89
+ }
90
+
91
+ # Add aspect ratio to image config if specified
92
+ if aspect_ratio:
93
+ generation_config["imageConfig"] = {
94
+ "aspectRatio": aspect_ratio
95
+ }
96
+
97
+ request_body = {
98
+ "contents": [{"parts": parts}],
99
+ "generationConfig": generation_config
100
+ }
87
101
 
88
102
  headers = {
89
103
  "x-goog-api-key": self.api_key,
@@ -92,14 +106,21 @@ class GeminiClient:
92
106
 
93
107
  try:
94
108
  logger.debug(f"Sending request to {url}")
109
+ logger.debug(f"Request body: {request_body}")
95
110
  response = await self.client.post(url, json=request_body, headers=headers)
96
111
  response.raise_for_status()
97
112
  data = response.json()
98
113
 
114
+ logger.debug(f"Response status: {response.status_code}")
115
+ logger.debug(f"Response data: {data}")
116
+
99
117
  # Extract images from response
100
118
  images = self._extract_images(data)
101
119
 
102
120
  if not images:
121
+ logger.error(f"No images extracted from response. Response structure: {list(data.keys())}")
122
+ if "candidates" in data:
123
+ logger.error(f"Candidates: {data['candidates']}")
103
124
  raise APIError("No image data found in Gemini API response")
104
125
 
105
126
  return {"images": images, "model": model, "response": data}
@@ -170,10 +191,13 @@ class GeminiClient:
170
191
  content = candidate.get("content", {})
171
192
  parts = content.get("parts", [])
172
193
  for part in parts:
173
- if "inline_data" in part:
174
- image_data = part["inline_data"].get("data")
194
+ # Handle both inline_data and inlineData formats
195
+ inline_data = part.get("inline_data") or part.get("inlineData")
196
+ if inline_data:
197
+ image_data = inline_data.get("data")
175
198
  if image_data:
176
199
  images.append(image_data)
200
+ logger.debug(f"Extracted image data of length: {len(image_data)}")
177
201
  except Exception as e:
178
202
  logger.warning(f"Error extracting images from response: {e}")
179
203
 
@@ -90,8 +90,13 @@ class ImagenClient:
90
90
  if negative_prompt:
91
91
  request_body["instances"][0]["negativePrompt"] = negative_prompt
92
92
 
93
+ # Note: Seed parameter is not supported by Imagen API (as of 2025)
94
+ # The API returns a 400 error if seed is provided
93
95
  if seed is not None:
94
- request_body["parameters"]["seed"] = seed
96
+ logger.warning(
97
+ "Seed parameter is not supported by Imagen API and will be ignored. "
98
+ "Images cannot be reproduced with a seed value."
99
+ )
95
100
 
96
101
  headers = {
97
102
  "Content-Type": "application/json",
@@ -77,8 +77,21 @@ async def generate_image_tool(
77
77
 
78
78
  if person_generation:
79
79
  validate_person_generation(person_generation)
80
+
81
+ # Warn if prompt may conflict with person_generation policy
82
+ if person_generation == "dont_allow":
83
+ person_keywords = ["person", "people", "man", "woman", "child", "human", "face", "portrait", "crowd"]
84
+ if any(keyword in prompt.lower() for keyword in person_keywords):
85
+ logger.warning(
86
+ f"Prompt contains person-related keywords but person_generation is set to 'dont_allow'. "
87
+ f"This may result in the API blocking image generation."
88
+ )
89
+
80
90
  if seed is not None:
81
91
  validate_seed(seed)
92
+ logger.warning(
93
+ "Note: The seed parameter is not currently supported by Imagen API and will be ignored."
94
+ )
82
95
 
83
96
  # Get settings
84
97
  settings = get_settings()
@@ -213,7 +226,7 @@ def register_generate_image_tool(mcp_server: Any) -> None:
213
226
  use_world_knowledge: Use real-world knowledge (Gemini only)
214
227
  person_generation: Person policy: dont_allow, allow_adult, allow_all (Imagen only)
215
228
  negative_prompt: What to avoid in the image (Imagen only)
216
- seed: Random seed for reproducibility (Imagen only)
229
+ seed: Random seed for reproducibility (NOT SUPPORTED - will be ignored)
217
230
 
218
231
  Available models:
219
232
  - gemini-2.5-flash-image (default)