@codingmantra/mcp-server 0.2.0 β†’ 0.2.2

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 (3) hide show
  1. package/README.md +34 -9
  2. package/build/index.js +529 -45
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -2,29 +2,41 @@
2
2
 
3
3
  The official **Model Context Protocol (MCP)** server connecting AI assistants (Claude Desktop, Cursor, Cline, and Antigravity) to CodingMantra's generative AI media engines.
4
4
 
5
- ## What's New in v0.2.0
5
+ ## What's New in v0.2.2
6
+ - **Current API coverage:** Story Teller, HeyGen Talking Avatar IV, and Jewellery Rate Poster tools.
7
+ - **Video contract alignment:** Required prompt/model/duration/resolution/aspect ratio, character descriptions, seed, guidance, and local reference-image resolution.
8
+ - **Terminal job handling:** Polling stops for completed, failed, or cancelled jobs.
9
+
6
10
  - πŸ–ΌοΈ **Native MCP Image Output**: Generated images (including QR codes, logos, try-on shots, and product photos) return standard MCP `ImageContent` so they render directly in your AI assistant's chat window.
7
11
  - πŸ“ **Local File Path Resolution**: Pass local paths (e.g. `./shoe.png` or `/Users/.../portrait.jpg`) directly in tool argumentsβ€”the server automatically reads and encodes them as base64 data URIs.
8
- - ⚑ **Expanded Tool Suite (20 Tools)**: Added support for Jewelry Try-On, Apparel Try-On, Product Try-On, Festival Posts, YouTube Thumbnails, Passport Photos, Sketch-to-Real, Upscaling, Wallet Credit Checking, and Model Catalog discovery.
12
+ - ⚑ **Expanded Tool Suite (28 Tools)**: Expanded image generation support including Passport Photos, Baby Milestones, YouTube Thumbnails, Blog Images, Nano Banana, Professional Photography, Sketch-to-Real, Human Builder, Apparel/Product/Jewelry Try-On, Festival Posts, Upscaling, and Discovery.
13
+ - 🎯 **Advanced Model & Resolution Parameters**: Direct support for `model`, `modelId`, `promptId`, custom reference images, and server-side credit synchronization.
9
14
  - πŸ›‘οΈ **Graceful Error Handling & 120s Timeout**: Informative error diagnostics when API keys are missing or requests time out, with clean stdio protocol execution.
10
15
 
11
16
  ---
12
17
 
13
18
  ## Features & Tool Suite
14
19
 
15
- The server exposes **20 specialized generative and utility tools** over standard I/O (`stdio`):
20
+ The server exposes **28 specialized generative and utility tools** over standard I/O (`stdio`):
16
21
 
17
22
  ### 1. Synchronous Image Generation (Immediate Inline Image Output)
18
- - **`generate_product_photo`** β€” Generates studio-grade commercial product photos with custom background scenes, ambient occlusion contact shadows, Hasselblad camera optics, resolutions (1K, 2K, 4K), aspect ratios, and dynamic logo/text overlays.
23
+ - **`generate_product_photo`** β€” Generates studio-grade commercial product photos with custom background scenes, ambient occlusion contact shadows, camera optics, resolutions (1K, 2K, 4K), aspect ratios, and dynamic logo/text overlays.
19
24
  - **`generate_logo`** β€” Generates bespoke vector-style or 3D brand logos with customizable typography, colors, industries, and reference images.
20
25
  - **`try_on_jewelry`** β€” Virtual luxury jewelry try-on with model styling, metal & gemstone preservation, Fresnel light dispersion, and anatomical contact shadows.
21
- - **`try_on_apparel`** β€” Virtual fashion apparel try-on with natural gravitational folds, realistic fabric tension, Hasselblad medium-format camera optics, and ground contact shadows.
26
+ - **`try_on_apparel`** β€” Virtual fashion apparel try-on with natural gravitational folds, realistic fabric tension, and ground contact shadows.
22
27
  - **`try_on_product`** β€” Universal commercial product staging and virtual try-on across footwear, accessories, cosmetics, eyewear, and furniture with 3-point studio lighting.
23
28
  - **`generate_festival_post`** β€” High-conversion festival marketing graphics, holiday greetings (Diwali, Eid, Christmas, New Year), and promotional banners with product and logo integration.
29
+ - **`build_human`** β€” Creates photorealistic AI human models tailored for brand photography, fashion, and marketing with complete demographic, facial, hair, and body customization, plus multi-view character sheets (2Γ—2 grid).
24
30
  - **`generate_youtube_thumbnail`** β€” High-CTR YouTube thumbnails with rule-of-thirds composition, emotional human expressions, vibrant contrast separation, and legible bold text overlays.
25
31
  - **`generate_passport_photo`** β€” Converts any portrait into an official, compliant passport or visa identity photo with pixel-level facial identity preservation.
26
32
  - **`sketch_to_real`** β€” Transforms hand-drawn sketches, line drawings, or product drafts into photorealistic commercial images while preserving ground-truth silhouettes.
27
- - **`upscale_image`** β€” Upscales and enhances any image with AI detail recovery, removing compression artifacts and increasing resolution up to 4K.
33
+ - **`edit_professional_photo`** β€” Transforms and grades portraits and personal photos into magazine-grade studio or editorial photography with natural dermal micro-pores and optical depth of field.
34
+ - **`edit_nano_banana`** β€” Creative multi-reference image editor and compositor combining multiple subjects, backgrounds, and artistic styles (figurines, chibi, anime, retro, 3D renders).
35
+ - **`generate_blog_image`** β€” Generates high-impact, editorial blog hero images, article thumbnails, and banners with clean composition, visual hierarchy, intentional negative space, and exact text overlays.
36
+ - **`generate_baby_milestone`** β€” Creates magical baby milestone keepsake portraits with pristine subject preservation, seamless background cutout, and organic milestone text integration.
37
+ - **`upscale_image`** β€” Restores a reference image with Pro AI at 4K (60 credits), checks output size and proportions, and returns the image synchronously. Fine details can change; review the result.
38
+
39
+ - **`generate_jewellery_rate_poster`** β€” Branded gold and silver rate posters using caller-supplied rates, business details, and optional product/logo images.
28
40
 
29
41
  ### 2. QR Code Tools
30
42
  - **`generate_qr_code`** β€” Full-featured custom QR code generator supporting URLs, plain text, Wi-Fi credentials, vCards, emails, and UPI payment strings with custom styling, colors, and error correction.
@@ -32,20 +44,30 @@ The server exposes **20 specialized generative and utility tools** over standard
32
44
 
33
45
  ### 3. Account & Discovery Utilities
34
46
  - **`get_user_credits`** β€” Checks your current CodingMantra AI wallet credit balance in real time.
35
- - **`list_image_models`** β€” Queries all available CodingMantra AI image generation models (Gemini Flash, Pro, Flux, etc.), supported resolutions, aspect ratios, and credit costs.
47
+ - **`list_image_models`** β€” Queries all available CodingMantra AI image generation models (Gemini Flash, Pro, Grok Imagine 2.0, GPT Image 2.5 Flare), supported resolutions, aspect ratios, and credit costs.
36
48
 
37
49
  ### 4. Asynchronous Video Tools (with Job Polling)
38
- - **`generate_product_video`** β€” Commercial product videography (Google Veo 3.1 & OpenRouter Wan 2.7).
50
+ - **`generate_product_video`** β€” Commercial product videography (Google Veo 3.1 & OpenRouter Wan 3.0).
39
51
  - **`generate_apparel_video`** β€” Model runway and apparel try-on video showcase.
40
52
  - **`generate_festival_video`** β€” Festive event greetings and celebratory motion graphics.
41
53
  - **`generate_jewelry_video`** β€” High-end luxury jewelry videography with realistic optical brilliance dispersion.
42
54
  - **`generate_logo_video`** β€” 3D logo reveal and motion graphic intros.
43
- - **`check_video_job_status`** β€” Real-time polling tool to track background video rendering status (`queued` β†’ `processing` β†’ `generating` β†’ `uploading` β†’ `completed` / `failed`).
55
+ - **`generate_story_video`** β€” Cinematic stories with character descriptions, sound effects, and visual atmosphere.
56
+ - **`generate_talking_avatar`** β€” HeyGen Avatar IV portrait animation with a script, HeyGen voice ID, and performance controls.
57
+ - **`check_video_job_status`** β€” Real-time polling tool to track background video rendering status (`pending` β†’ `processing` β†’ `completed` / `failed` / `cancelled`).
44
58
 
45
59
  All generations automatically deduct credits from your CodingMantra wallet and persist outputs directly to your online media gallery at [https://codingmantra.com/my-gallery](https://codingmantra.com/my-gallery).
46
60
 
47
61
  ---
48
62
 
63
+ ## Video parameters
64
+
65
+ General video tools require `prompt` (10–5000 characters), `model`, `timeDuration`, `resolution`, and `aspectRatio`. Use model-supported settings; Veo requires 8 seconds for 1080p, references, or an end frame. Choose one image mode: main image, frames, or references. Reference images accept URLs, data URIs, or local paths (up to 3 for Veo). Optional settings include characters, seed, guidanceScale, soundEffects, and styleAmbiance.
66
+
67
+ Talking Avatar requires `image` (local PNG/JPEG/WebP path or data URI, not a public URL), `script`, and a HeyGen `voiceId`. Optional controls include targetDuration (5–120 seconds, default 15), speed (0.5–1.5), performancePreset, expressiveness, motionPrompt, backgroundMode/backgroundColor, captions, title, resolution (720p or 1080p, default 1080p), and aspectRatio (9:16, 1:1, or 16:9, default 9:16). Scripts must fit the duration budget; credits are calculated by the backend. Poll every 15–30 seconds until completed, failed, or cancelled.
68
+
69
+ ---
70
+
49
71
  ## Quick Setup
50
72
 
51
73
  ### 1. Obtain Your API Key
@@ -152,6 +174,9 @@ Once configured, restart your AI assistant and try prompts like:
152
174
  # Build TypeScript
153
175
  npm run build
154
176
 
177
+ # Verify stdio contracts with a mock API (no credits spent)
178
+ npm test
179
+
155
180
  # Start server directly on stdio
156
181
  CODINGMANTRA_API_KEY=your_key node build/index.js
157
182
  ```
package/build/index.js CHANGED
@@ -6,7 +6,7 @@ import { apiClient } from './api-client.js';
6
6
  import { formatImageToolResult, resolveImageInput, resolveImagesArray } from './image-utils.js';
7
7
  const server = new Server({
8
8
  name: "codingmantra-mcp",
9
- version: "0.2.0",
9
+ version: "0.2.2",
10
10
  }, {
11
11
  capabilities: {
12
12
  tools: {},
@@ -22,26 +22,38 @@ const IMAGE_SOURCE_SCHEMA = {
22
22
  }
23
23
  };
24
24
  const COMMON_VIDEO_PROPERTIES = {
25
- prompt: { type: "string", description: "Detailed video description or creative prompt." },
25
+ prompt: { type: "string", minLength: 10, maxLength: 5000, description: "Required video description or creative prompt (10-5000 characters)." },
26
26
  mainImage: { type: "string", description: "Base64 data URI, local file path, or public URL for the main subject image (Image-to-Video mode)." },
27
27
  startImage: { type: "string", description: "Base64 data URI, local file path, or public URL for the first frame." },
28
28
  endImage: { type: "string", description: "Base64 data URI, local file path, or public URL for the last frame." },
29
29
  referenceImages: {
30
30
  type: "array",
31
- items: { type: "object", properties: { image: { type: "string" }, label: { type: "string" } } },
32
- description: "Array of reference images for style matching."
31
+ maxItems: 4,
32
+ items: { type: "object", properties: { image: { type: "string", description: "Public image URL, data URI, or local file path." }, label: { type: "string", description: "Optional reference label." } }, required: ["image"] },
33
+ description: "Reference images for style matching. Choose only one image mode: main image, frames, or references. Veo supports up to 3 references and requires 8 seconds for references or an end frame."
33
34
  },
34
35
  negativePrompt: { type: "string", description: "Elements to exclude from the video." },
35
- dialogue: { type: "string", description: "Optional voiceover or dialogue script." },
36
+ dialogue: { type: "string", maxLength: 200, description: "Optional voiceover or dialogue script (up to 200 characters)." },
36
37
  soundSuggestion: { type: "string", description: "Background music or sound effects direction." },
37
38
  cameraMotion: { type: "string", description: "Camera motion instructions (e.g., 'orbit right', 'slow push-in')." },
38
39
  ambientNoise: { type: "string", description: "Ambient sound description." },
39
40
  language: { type: "string", description: "Voiceover language." },
40
- timeDuration: { type: "string", description: "Video duration in seconds. Default is '4'." },
41
- resolution: { type: "string", description: "Resolution (e.g., '720p', '1080p'). Default is '720p'." },
42
- model: { type: "string", description: "Model slug (e.g., 'google/veo-3.1-fast', 'openrouter/wan-2.7')." },
43
- aspectRatio: { type: "string", description: "Aspect ratio (e.g., '9:16', '16:9'). Default is '9:16'." },
44
- generateAudio: { type: "boolean", description: "Whether to generate synchronized audio. Default is false." }
41
+ timeDuration: { type: "string", description: "Required duration in seconds supported by the selected model. Veo supports 4, 6, or 8; use 8 for 1080p, references, or an end frame." },
42
+ resolution: { type: "string", description: "Required resolution supported by the selected model (480p, 720p, 768p, or 1080p)." },
43
+ model: { type: "string", description: "Model slug (e.g., 'google/veo-3.1-fast', 'alibaba/wan-3.0')." },
44
+ aspectRatio: { type: "string", description: "Required aspect ratio supported by the selected model (e.g., 9:16 or 16:9)." },
45
+ generateAudio: { type: "boolean", description: "Whether to generate synchronized audio. Default is false." },
46
+ seed: { type: "integer", minimum: 0, maximum: Number.MAX_SAFE_INTEGER, description: "Optional nonnegative random seed for models that support it." },
47
+ guidanceScale: { type: "number", description: "Optional guidance strength for models that support it." },
48
+ soundEffects: { type: "string", description: "Sound effects direction for Story Teller." },
49
+ styleAmbiance: { type: "string", description: "Visual style and atmosphere for Story Teller." },
50
+ characters: { type: "array", description: "Optional named characters for consistent storytelling.", items: {
51
+ type: "object", properties: {
52
+ id: { type: "string", description: "Unique character ID." },
53
+ name: { type: "string", description: "Character name." },
54
+ description: { type: "string", description: "Character appearance and role." }
55
+ }, required: ["id", "name", "description"]
56
+ } }
45
57
  };
46
58
  // ─── Tool Definitions ──────────────────────────────────────────────────────────
47
59
  // 1. Product Photography
@@ -107,7 +119,7 @@ const GENERATE_PRODUCT_PHOTO_TOOL = {
107
119
  // 2. Logo Creator
108
120
  const GENERATE_LOGO_TOOL = {
109
121
  name: "generate_logo",
110
- description: "Generates bespoke vector-style or 3D brand logos with customizable typography, colors, industries, and reference images. Returns the generated logo directly for inline display (synchronous).",
122
+ description: "Generates bespoke vector-style brand logos, monograms, emblems, and modern wordmarks with character-perfect typography, color palettes, and reference image guidance. Default model is Flash. Returns the generated logo directly for inline display (synchronous).",
111
123
  inputSchema: {
112
124
  type: "object",
113
125
  properties: {
@@ -137,15 +149,19 @@ const GENERATE_LOGO_TOOL = {
137
149
  },
138
150
  aspectRatio: {
139
151
  type: "string",
140
- description: "Output aspect ratio. Default is '1:1'.",
152
+ description: "Output aspect ratio ('1:1', '16:9', '4:3'). Default is '1:1'.",
153
+ },
154
+ model: {
155
+ type: "string",
156
+ description: "Model tier to use ('flash' or 'pro'). Default is 'flash' (google/gemini-3.1-flash-image)."
141
157
  },
142
158
  modelId: {
143
159
  type: "string",
144
- description: "The image model ID. Default uses platform default.",
160
+ description: "Full image model ID if specific model desired (e.g. google/gemini-3.1-flash-image).",
145
161
  },
146
162
  resolution: {
147
163
  type: "string",
148
- description: "Output resolution ('1K', '2K'). Default is '1K'.",
164
+ description: "Output resolution ('1K', '2K', '4K'). Default is '1K'.",
149
165
  },
150
166
  referenceImage: {
151
167
  type: "string",
@@ -189,7 +205,7 @@ const TRY_ON_JEWELRY_TOOL = {
189
205
  },
190
206
  model: {
191
207
  type: "string",
192
- description: "Model tier slug ('standard', 'pro', 'flash'). Default is 'pro'."
208
+ description: "Model tier slug ('standard', 'pro', 'flash'). Default is 'flash'."
193
209
  },
194
210
  referenceImage: {
195
211
  type: "string",
@@ -218,7 +234,7 @@ const TRY_ON_JEWELRY_TOOL = {
218
234
  // 4. Apparel Try-On
219
235
  const TRY_ON_APPAREL_TOOL = {
220
236
  name: "try_on_apparel",
221
- description: "Virtual fashion apparel try-on. Drapes garments realistically along model anatomy with natural gravitational folds, realistic tension, Hasselblad medium-format camera optics, and ground contact shadows. Returns generated image directly (synchronous).",
237
+ description: "Virtual fashion apparel try-on. Drapes garments realistically along model anatomy with natural gravitational folds, realistic tension, ambient occlusion contact shadows, and editorial lighting. Default model tier is Flash. Returns generated image directly (synchronous).",
222
238
  inputSchema: {
223
239
  type: "object",
224
240
  properties: {
@@ -237,12 +253,16 @@ const TRY_ON_APPAREL_TOOL = {
237
253
  },
238
254
  aspectRatio: {
239
255
  type: "string",
240
- description: "Output aspect ratio ('1:1', '9:16', '16:9', '4:5'). Default is '1:1'."
256
+ description: "Output aspect ratio ('9:16', '1:1', '16:9', '4:5'). Default is '9:16'."
241
257
  },
242
258
  resolution: {
243
259
  type: "string",
244
260
  description: "Output resolution ('1K', '2K', '4K'). Default is '1K'."
245
261
  },
262
+ model: {
263
+ type: "string",
264
+ description: "The model tier ('flash', 'pro', 'standard'). Default is 'flash'."
265
+ },
246
266
  referenceImage: {
247
267
  type: "string",
248
268
  description: "Optional style reference image URL, data URI, or local path."
@@ -266,7 +286,7 @@ const TRY_ON_APPAREL_TOOL = {
266
286
  // 5. Product Try-On
267
287
  const TRY_ON_PRODUCT_TOOL = {
268
288
  name: "try_on_product",
269
- description: "Universal commercial product staging and try-on across footwear, accessories, watches, eyewear, cosmetics, and furniture with 3-point studio lighting and ambient occlusion contact shadows. Returns generated image directly (synchronous).",
289
+ description: "Universal commercial product staging and try-on across footwear, accessories, watches, eyewear, cosmetics, and furniture with 3-point studio lighting and ambient occlusion contact shadows. Default model tier is Flash. Returns generated image directly (synchronous).",
270
290
  inputSchema: {
271
291
  type: "object",
272
292
  properties: {
@@ -295,6 +315,10 @@ const TRY_ON_PRODUCT_TOOL = {
295
315
  type: "string",
296
316
  description: "Output resolution ('1K', '2K', '4K'). Default is '1K'."
297
317
  },
318
+ model: {
319
+ type: "string",
320
+ description: "The model tier ('flash', 'pro', 'standard'). Default is 'flash'."
321
+ },
298
322
  referenceImage: {
299
323
  type: "string",
300
324
  description: "Optional style reference image."
@@ -314,7 +338,7 @@ const TRY_ON_PRODUCT_TOOL = {
314
338
  // 6. Festival Post Generator
315
339
  const GENERATE_FESTIVAL_POST_TOOL = {
316
340
  name: "generate_festival_post",
317
- description: "Generates high-conversion festival marketing graphics, holiday greetings (Diwali, Eid, Christmas, New Year, Valentine's), and promotional event banners with product and brand logo integration. Returns generated image directly (synchronous).",
341
+ description: "Generates high-conversion festival marketing graphics, holiday greetings (Diwali, Eid, Christmas, New Year, Valentine's), and promotional event banners with product and brand logo integration. Default model is Flash. Returns generated image directly (synchronous).",
318
342
  inputSchema: {
319
343
  type: "object",
320
344
  properties: {
@@ -338,6 +362,10 @@ const GENERATE_FESTIVAL_POST_TOOL = {
338
362
  type: "string",
339
363
  description: "Supporting promotional message or contact details."
340
364
  },
365
+ model: {
366
+ type: "string",
367
+ description: "The model tier ('flash', 'pro', 'standard'). Default is 'flash' (Gemini 3.1 Flash)."
368
+ },
341
369
  aspectRatio: {
342
370
  type: "string",
343
371
  description: "Output aspect ratio ('1:1', '9:16', '16:9'). Default is '1:1'."
@@ -350,7 +378,47 @@ const GENERATE_FESTIVAL_POST_TOOL = {
350
378
  required: ["festivalPrompt"]
351
379
  }
352
380
  };
353
- // 7. YouTube Thumbnail Generator
381
+ // 7. Human Builder / Virtual Model Generator
382
+ const BUILD_HUMAN_TOOL = {
383
+ name: "build_human",
384
+ description: "Creates photorealistic AI human models tailored for brand photography, fashion, ecommerce, and marketing campaigns with complete demographic, facial, hair, and body customization, plus multi-view character sheets (2x2 grid). Default model tier is Flash. Returns generated image directly (synchronous).",
385
+ inputSchema: {
386
+ type: "object",
387
+ properties: {
388
+ name: { type: "string", description: "Optional name or character identifier for the model." },
389
+ age: { type: "string", description: "Age category or specific age (e.g., 'Young Adult', '25 years old', 'Middle-aged')." },
390
+ gender: { type: "string", description: "Gender identity (e.g., 'Female', 'Male', 'Non-binary')." },
391
+ culturalTraits: { type: "string", description: "Ethnicity or cultural heritage (e.g., 'South Asian', 'East Asian', 'Caucasian', 'African')." },
392
+ country: { type: "string", description: "Country of origin (e.g., 'India', 'Japan', 'France', 'Brazil')." },
393
+ skinTone: { type: "string", description: "Complexion and skin tone (e.g., 'Medium Warm', 'Fair Porcelain', 'Rich Deep Bronze')." },
394
+ eyeColor: { type: "string", description: "Eye color (e.g., 'Dark Brown', 'Hazel Green', 'Deep Blue')." },
395
+ eyeShape: { type: "string", description: "Eye shape (e.g., 'Almond', 'Round', 'Monolid', 'Hooded')." },
396
+ noseShape: { type: "string", description: "Nose shape (e.g., 'Natural Straight', 'Aquiline', 'Button', 'Broad')." },
397
+ faceShape: { type: "string", description: "Face shape (e.g., 'Oval', 'Square', 'Heart', 'Round')." },
398
+ hairStyle: { type: "string", description: "Hairstyle (e.g., 'Long Waves', 'Buzz Cut', 'Sleek Bob', 'Afro', 'Layered Cut')." },
399
+ hairColor: { type: "string", description: "Hair color (e.g., 'Natural Black', 'Chestnut Brown', 'Honey Blonde')." },
400
+ hairThickness: { type: "string", description: "Hair density (e.g., 'Thick', 'Medium', 'Fine')." },
401
+ hairType: { type: "string", description: "Hair texture (e.g., 'Straight', 'Wavy', 'Curly', 'Coily')." },
402
+ bodySize: { type: "string", description: "Body build (e.g., 'Petite', 'Slim Athletic', 'Medium', 'Curvy', 'Plus Size')." },
403
+ bodyHeight: { type: "string", description: "Height description (e.g., 'Petite', 'Average', 'Tall Fashion Model')." },
404
+ bodyShape: { type: "string", description: "Body shape (e.g., 'Hourglass', 'Athletic Rectangular', 'Pear', 'Inverted Triangle')." },
405
+ muscleDefinition: { type: "string", description: "Muscle definition (e.g., 'Soft Natural', 'Toned Athletic', 'Defined Muscular')." },
406
+ cupSize: { type: "string", description: "Bust proportion if female (e.g., 'Small', 'Medium', 'Full')." },
407
+ extraDescription: { type: "string", description: "Extra unique physical traits (e.g., 'light freckles across nose bridge, subtle smile')." },
408
+ customTweakPrompt: { type: "string", description: "Custom refinement or scene styling prompt (e.g., 'wearing an ivory cashmere turtleneck against a warm minimalist studio backdrop')." },
409
+ generateMultiView: { type: "boolean", description: "Generate a 4-panel consistent character sheet in a 2x2 grid (Front, Side, 3/4, Close-up detail). Default is false." },
410
+ referenceImages: {
411
+ type: "array",
412
+ items: { type: "string" },
413
+ description: "Optional array of reference face or body images (URLs, data URIs, or local file paths) to guide identity."
414
+ },
415
+ aspectRatio: { type: "string", description: "Output aspect ratio ('1:1', '9:16', '4:5', '16:9'). Default is '1:1'." },
416
+ resolution: { type: "string", description: "Output resolution ('1K', '2K', '4K'). Default is '1K'." },
417
+ model: { type: "string", description: "Model tier ('flash', 'pro', 'standard'). Default is 'flash'." }
418
+ }
419
+ }
420
+ };
421
+ // 8. YouTube Thumbnail Generator
354
422
  const GENERATE_YOUTUBE_THUMBNAIL_TOOL = {
355
423
  name: "generate_youtube_thumbnail",
356
424
  description: "Generates high-CTR YouTube thumbnails with rule-of-thirds composition, emotional human expressions, vibrant contrast separation, and legible bold text overlays. Returns generated image directly (synchronous).",
@@ -377,13 +445,29 @@ const GENERATE_YOUTUBE_THUMBNAIL_TOOL = {
377
445
  type: "string",
378
446
  description: "Optional channel/brand logo to place in corner."
379
447
  },
448
+ referenceImage: {
449
+ type: "string",
450
+ description: "Optional style or concept reference image (URL, data URI, or local file path)."
451
+ },
452
+ promptId: {
453
+ type: "string",
454
+ description: "Optional ID or title of a pre-defined layout style template from youtubeThumbnailPrompts."
455
+ },
456
+ model: {
457
+ type: "string",
458
+ description: "Model tier ('flash', 'pro', 'standard'). Default is 'flash' (google/gemini-3.1-flash-image)."
459
+ },
460
+ modelId: {
461
+ type: "string",
462
+ description: "The image model ID."
463
+ },
380
464
  aspectRatio: {
381
465
  type: "string",
382
466
  description: "Thumbnail aspect ratio. Default is '16:9'."
383
467
  },
384
468
  resolution: {
385
469
  type: "string",
386
- description: "Output resolution ('1K', '2K'). Default is '1K'."
470
+ description: "Output resolution ('1K', '2K', '4K'). Default is '1K'."
387
471
  }
388
472
  },
389
473
  required: ["prompt"]
@@ -392,34 +476,50 @@ const GENERATE_YOUTUBE_THUMBNAIL_TOOL = {
392
476
  // 8. Passport Photo Creator
393
477
  const GENERATE_PASSPORT_PHOTO_TOOL = {
394
478
  name: "generate_passport_photo",
395
- description: "Converts any portrait into an official, compliant passport or visa identity photo with pixel-level facial identity preservation, neutral lighting, and plain white/off-white background. Returns generated image directly (synchronous).",
479
+ description: "Converts any portrait into an official, compliant passport or visa identity photo with pixel-level facial identity preservation, neutral lighting, and plain white/off-white background. Default model tier is Flash. Default aspect ratio is '1:1'. Returns generated image directly (synchronous).",
396
480
  inputSchema: {
397
481
  type: "object",
398
482
  properties: {
399
483
  photoDataUri: {
400
484
  type: "string",
401
- description: "Source portrait photo (URL, data URI, or local file path)."
485
+ description: "Source portrait photo (URL, data URI, or local file path) to convert."
402
486
  },
403
487
  prompt: {
404
488
  type: "string",
405
489
  description: "Adjustments (e.g., 'white background, formal dark navy business suit, centered frontal view')."
406
490
  },
491
+ promptId: {
492
+ type: "string",
493
+ description: "Optional ID or title of a pre-defined style template from passportPhotoPrompts."
494
+ },
495
+ referenceImage: {
496
+ type: "string",
497
+ description: "Optional style reference image (URL, data URI, or local file path) to guide attire or lighting."
498
+ },
499
+ model: {
500
+ type: "string",
501
+ description: "Model tier ('flash', 'pro', 'standard'). Default is 'flash' (google/gemini-3.1-flash-image)."
502
+ },
503
+ modelId: {
504
+ type: "string",
505
+ description: "The image model ID."
506
+ },
407
507
  aspectRatio: {
408
508
  type: "string",
409
- description: "Passport aspect ratio ('1:1', '4:5'). Default is '1:1'."
509
+ description: "Passport aspect ratio ('1:1', '4:5', '3:4'). Default is '1:1'."
410
510
  },
411
511
  resolution: {
412
512
  type: "string",
413
- description: "Output resolution ('1K', '2K'). Default is '1K'."
513
+ description: "Output resolution ('1K', '2K', '4K'). Default is '1K'."
414
514
  }
415
515
  },
416
516
  required: ["photoDataUri"]
417
517
  }
418
518
  };
419
- // 9. Sketch to Real
519
+ // 10. Sketch to Real
420
520
  const SKETCH_TO_REAL_TOOL = {
421
521
  name: "sketch_to_real",
422
- description: "Transforms hand-drawn sketches, line drawings, or product drafts into photorealistic commercial images while strictly preserving the sketched silhouette, proportions, and outlines. Returns generated image directly (synchronous).",
522
+ description: "Transforms hand-drawn sketches, line drawings, or product drafts into photorealistic commercial images while strictly preserving the sketched silhouette, proportions, and outlines. Default model tier is Flash. Returns generated image directly (synchronous).",
423
523
  inputSchema: {
424
524
  type: "object",
425
525
  properties: {
@@ -435,9 +535,29 @@ const SKETCH_TO_REAL_TOOL = {
435
535
  type: "string",
436
536
  description: "Target render style ('Photorealistic', 'Cinematic', '3D Render'). Default is 'Photorealistic'."
437
537
  },
538
+ model: {
539
+ type: "string",
540
+ description: "Model tier ('flash', 'pro', 'standard'). Default is 'flash'."
541
+ },
542
+ referenceImage: {
543
+ type: "string",
544
+ description: "Optional style/concept reference image (URL, data URI, or local file path)."
545
+ },
546
+ logoImage: {
547
+ type: "string",
548
+ description: "Optional brand logo overlay (URL, data URI, or local file path)."
549
+ },
550
+ overlayText: {
551
+ type: "string",
552
+ description: "Optional headline text overlay."
553
+ },
554
+ marketingText: {
555
+ type: "string",
556
+ description: "Optional marketing copy overlay."
557
+ },
438
558
  aspectRatio: {
439
559
  type: "string",
440
- description: "Output aspect ratio ('1:1', '16:9', '9:16'). Default is '1:1'."
560
+ description: "Output aspect ratio ('1:1', '16:9', '9:16', '4:5'). Default is '1:1'."
441
561
  },
442
562
  resolution: {
443
563
  type: "string",
@@ -447,10 +567,201 @@ const SKETCH_TO_REAL_TOOL = {
447
567
  required: ["sketchImage"]
448
568
  }
449
569
  };
450
- // 10. Upscale Image
570
+ // 11. Professional Photography Editor
571
+ const EDIT_PROFESSIONAL_PHOTO_TOOL = {
572
+ name: "edit_professional_photo",
573
+ description: "Transforms, grades, and enhances portraits and lifestyle photos into magazine-grade studio or commercial editorial photography. Enforces natural dermal micro-pores, authentic iris catchlights, directional studio lighting, and realistic depth of field. Default model tier is Flash. Returns generated image directly (synchronous).",
574
+ inputSchema: {
575
+ type: "object",
576
+ properties: {
577
+ images: {
578
+ type: "array",
579
+ items: IMAGE_SOURCE_SCHEMA,
580
+ description: "Array of subject reference photos (URL, data URI, or local file path). Each item can have 'url', 'dataUrl', or local 'path'. At least one required."
581
+ },
582
+ prompt: {
583
+ type: "string",
584
+ description: "Enhancement instruction or desired photo transformation (e.g., 'warm dusk cinematic lighting, shallow depth of field, natural skin texture, magazine editorial portrait')."
585
+ },
586
+ image: {
587
+ type: "string",
588
+ description: "Convenience single subject photo (URL, data URI, or local file path) if only providing one image."
589
+ },
590
+ referenceImage: {
591
+ type: "string",
592
+ description: "Optional style or concept reference image (URL, data URI, or local file path)."
593
+ },
594
+ promptId: {
595
+ type: "string",
596
+ description: "Optional ID or title of a pre-defined photography scene template."
597
+ },
598
+ model: {
599
+ type: "string",
600
+ description: "Model tier ('flash', 'pro', 'standard'). Default is 'flash' (google/gemini-3.1-flash-image)."
601
+ },
602
+ modelId: {
603
+ type: "string",
604
+ description: "The image model ID."
605
+ },
606
+ resolution: {
607
+ type: "string",
608
+ description: "Output resolution ('1K', '2K', '4K'). Default is '1K'."
609
+ },
610
+ aspectRatio: {
611
+ type: "string",
612
+ description: "Output aspect ratio ('1:1', '4:5', '9:16', '16:9'). Default is '1:1'."
613
+ }
614
+ },
615
+ required: ["prompt"]
616
+ }
617
+ };
618
+ // 12. Nano Banana Image Editor (AI)
619
+ const EDIT_NANO_BANANA_TOOL = {
620
+ name: "edit_nano_banana",
621
+ description: "Creative multi-reference AI image editor and compositor. Generates, modifies, or restyles images from multiple reference photos and text instructions with multi-subject composition, perspective alignment, ground contact shadows, and versatile artistic styles (photorealistic, action figurine, chibi/Funko Pop, anime/Ghibli, 3D render). Default model tier is Flash. Returns generated image directly (synchronous).",
622
+ inputSchema: {
623
+ type: "object",
624
+ properties: {
625
+ images: {
626
+ type: "array",
627
+ items: IMAGE_SOURCE_SCHEMA,
628
+ description: "Array of reference images (URL, data URI, or local file path). Each item can have 'url', 'dataUrl', or local 'path'. At least one required."
629
+ },
630
+ prompt: {
631
+ type: "string",
632
+ description: "The creative editing or generation prompt describing desired composition, style, or changes."
633
+ },
634
+ image: {
635
+ type: "string",
636
+ description: "Convenience single reference photo (URL, data URI, or local file path) if only providing one image."
637
+ },
638
+ referenceImage: {
639
+ type: "string",
640
+ description: "Optional style or concept reference image (URL, data URI, or local file path)."
641
+ },
642
+ promptId: {
643
+ type: "string",
644
+ description: "Optional ID or title of a pre-defined style template (e.g., 'action-figure', 'funko-pop', 'studio-ghibli', '16bit-game-character')."
645
+ },
646
+ model: {
647
+ type: "string",
648
+ description: "Model tier ('flash', 'pro', 'standard'). Default is 'flash' (google/gemini-3.1-flash-image)."
649
+ },
650
+ modelId: {
651
+ type: "string",
652
+ description: "The image model ID."
653
+ },
654
+ resolution: {
655
+ type: "string",
656
+ description: "Output resolution ('1K', '2K', '4K'). Default is '1K'."
657
+ },
658
+ aspectRatio: {
659
+ type: "string",
660
+ description: "Output aspect ratio ('1:1', '4:5', '9:16', '16:9'). Default is '1:1'."
661
+ }
662
+ },
663
+ required: ["prompt"]
664
+ }
665
+ };
666
+ // 13. Blog Image Generator (AI)
667
+ const GENERATE_BLOG_IMAGE_TOOL = {
668
+ name: "generate_blog_image",
669
+ description: "Generates high-impact, editorial blog hero images, article thumbnails, and banners with clean composition, visual hierarchy, intentional negative space, and exact text overlays. Default aspect ratio is 16:9. Default model tier is Flash. Returns generated image directly (synchronous).",
670
+ inputSchema: {
671
+ type: "object",
672
+ properties: {
673
+ prompt: {
674
+ type: "string",
675
+ description: "Description of the desired blog hero image, article concept, or editorial illustration."
676
+ },
677
+ overlayText: {
678
+ type: "string",
679
+ description: "Optional short text, title, or headline to overlay legibly on the image."
680
+ },
681
+ referenceImage: {
682
+ type: "string",
683
+ description: "Optional style or aesthetic reference image (URL, data URI, or local file path)."
684
+ },
685
+ promptId: {
686
+ type: "string",
687
+ description: "Optional ID or title of a pre-defined style template from blogImagePrompts (e.g., 'neon-cyber-circuit', 'balancing-stones')."
688
+ },
689
+ model: {
690
+ type: "string",
691
+ description: "Model tier ('flash', 'pro', 'standard'). Default is 'flash' (google/gemini-3.1-flash-image)."
692
+ },
693
+ modelId: {
694
+ type: "string",
695
+ description: "The image model ID."
696
+ },
697
+ resolution: {
698
+ type: "string",
699
+ description: "Output resolution ('1K', '2K', '4K'). Default is '1K'."
700
+ },
701
+ aspectRatio: {
702
+ type: "string",
703
+ description: "Output aspect ratio ('16:9', '1:1', '4:3', '3:4', '9:16', '4:5'). Default is '16:9'."
704
+ }
705
+ },
706
+ required: ["prompt"]
707
+ }
708
+ };
709
+ // 14. Baby Milestone Generator
710
+ const GENERATE_BABY_MILESTONE_TOOL = {
711
+ name: "generate_baby_milestone",
712
+ description: "Creates magical baby milestone keepsake portraits by isolating the baby and generating enchanting themed backgrounds with organic milestone text integration, while preserving the baby's exact face, expression, skin tone, clothing, and posture. Default model tier is Flash. Default aspect ratio is '1:1'. Returns generated image directly (synchronous).",
713
+ inputSchema: {
714
+ type: "object",
715
+ properties: {
716
+ photoDataUri: {
717
+ type: "string",
718
+ description: "The baby photo (URL, data URI, or local file path) to isolate and preserve as the main subject."
719
+ },
720
+ milestoneValue: {
721
+ type: "number",
722
+ description: "Milestone number (e.g., 1, 3, 6, 12)."
723
+ },
724
+ milestoneUnit: {
725
+ type: "string",
726
+ enum: ["month", "year"],
727
+ description: "Unit for milestone ('month' or 'year')."
728
+ },
729
+ customPrompt: {
730
+ type: "string",
731
+ description: "Creative theme or environment instructions (e.g., 'Enchanted woodland forest with soft morning sunbeams and wildflowers')."
732
+ },
733
+ promptId: {
734
+ type: "string",
735
+ description: "Optional ID or title of a pre-defined style preset from babyMilestonePrompts."
736
+ },
737
+ referenceImage: {
738
+ type: "string",
739
+ description: "Optional environmental style reference image (URL, data URI, or local file path)."
740
+ },
741
+ model: {
742
+ type: "string",
743
+ description: "Model tier ('flash', 'pro', 'standard'). Default is 'flash' (google/gemini-3.1-flash-image)."
744
+ },
745
+ modelId: {
746
+ type: "string",
747
+ description: "The image model ID."
748
+ },
749
+ resolution: {
750
+ type: "string",
751
+ description: "Output resolution ('1K', '2K', '4K'). Default is '1K'."
752
+ },
753
+ aspectRatio: {
754
+ type: "string",
755
+ description: "Output aspect ratio ('1:1', '4:5', '3:4', '16:9', '9:16'). Default is '1:1'."
756
+ }
757
+ },
758
+ required: ["photoDataUri"]
759
+ }
760
+ };
761
+ // 13. Upscale Image
451
762
  const UPSCALE_IMAGE_TOOL = {
452
763
  name: "upscale_image",
453
- description: "Upscales and enhances any image with AI detail recovery, removing compression artifacts and increasing resolution. Returns upscaled image directly (synchronous).",
764
+ description: "Enhances a reference image with the Pro AI model at 4K. Preserves composition through instructions and validates larger dimensions and matching proportions. AI may alter fine details. Uses 60 credits; returns the upscaled image synchronously.",
454
765
  inputSchema: {
455
766
  type: "object",
456
767
  properties: {
@@ -526,7 +837,7 @@ const GET_USER_CREDITS_TOOL = {
526
837
  // 14. List Image Models
527
838
  const LIST_IMAGE_MODELS_TOOL = {
528
839
  name: "list_image_models",
529
- description: "Lists all available CodingMantra AI image generation models (e.g., Gemini Flash, Gemini Pro, Flux Pro), including supported resolutions, aspect ratios, and credit costs.",
840
+ description: "Lists all available CodingMantra AI image generation models (e.g., Gemini Flash, Gemini Pro, Grok Imagine 2.0, GPT Image 2.5 Flare), including supported resolutions, aspect ratios, and credit costs.",
530
841
  inputSchema: {
531
842
  type: "object",
532
843
  properties: {}
@@ -536,36 +847,93 @@ const LIST_IMAGE_MODELS_TOOL = {
536
847
  const GENERATE_PRODUCT_VIDEO_TOOL = {
537
848
  name: "generate_product_video",
538
849
  description: "Generates commercial product videography. Asynchronous: returns a jobId. You MUST use check_video_job_status with the jobId to poll for completion.",
539
- inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES }
850
+ inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES, required: ["prompt", "model", "resolution", "aspectRatio", "timeDuration"] }
540
851
  };
541
852
  // 16. Apparel Video Generation (Async)
542
853
  const GENERATE_APPAREL_VIDEO_TOOL = {
543
854
  name: "generate_apparel_video",
544
855
  description: "Generates runway fashion and apparel motion showcase videos. Asynchronous: returns a jobId. You MUST use check_video_job_status with the jobId to poll for completion.",
545
- inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES }
856
+ inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES, required: ["prompt", "model", "resolution", "aspectRatio", "timeDuration"] }
546
857
  };
547
858
  // 17. Festival Video Generation (Async)
548
859
  const GENERATE_FESTIVAL_VIDEO_TOOL = {
549
860
  name: "generate_festival_video",
550
861
  description: "Generates celebratory festival greetings and motion graphics. Asynchronous: returns a jobId. You MUST use check_video_job_status with the jobId to poll for completion.",
551
- inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES }
862
+ inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES, required: ["prompt", "model", "resolution", "aspectRatio", "timeDuration"] }
552
863
  };
553
864
  // 18. Jewelry Video Generation (Async)
554
865
  const GENERATE_JEWELRY_VIDEO_TOOL = {
555
866
  name: "generate_jewelry_video",
556
867
  description: "Generates luxury jewelry videography with optical brilliance and rotating display. Asynchronous: returns a jobId. You MUST use check_video_job_status with the jobId to poll for completion.",
557
- inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES }
868
+ inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES, required: ["prompt", "model", "resolution", "aspectRatio", "timeDuration"] }
558
869
  };
559
870
  // 19. Logo Video Generation (Async)
560
871
  const GENERATE_LOGO_VIDEO_TOOL = {
561
872
  name: "generate_logo_video",
562
873
  description: "Generates 3D logo reveal and motion graphic video intros. Asynchronous: returns a jobId. You MUST use check_video_job_status with the jobId to poll for completion.",
563
- inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES }
874
+ inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES, required: ["prompt", "model", "resolution", "aspectRatio", "timeDuration"] }
875
+ };
876
+ const GENERATE_STORY_VIDEO_TOOL = {
877
+ name: "generate_story_video",
878
+ description: "Generates cinematic story videos with character descriptions, reference images, sound effects, and atmosphere. Asynchronous: returns a jobId; poll check_video_job_status until completed, failed, or cancelled.",
879
+ inputSchema: { type: "object", properties: COMMON_VIDEO_PROPERTIES, required: ["prompt", "model", "resolution", "aspectRatio", "timeDuration"] }
880
+ };
881
+ const GENERATE_TALKING_AVATAR_TOOL = {
882
+ name: "generate_talking_avatar",
883
+ description: "Animates a portrait with HeyGen Avatar IV lip sync from a script and HeyGen voice ID. Asynchronous: returns a jobId; poll check_video_job_status until completed, failed, or cancelled. Credits are calculated by the server from the script budget and resolution.",
884
+ inputSchema: {
885
+ type: "object",
886
+ properties: {
887
+ image: { type: "string", description: "PNG, JPEG, or WebP portrait as a base64 data URI or local file path. Public URLs are not accepted." },
888
+ speechMode: { type: "string", enum: ["text"], default: "text", description: "Speech source; currently only text is supported." },
889
+ script: { type: "string", minLength: 3, maxLength: 2000, description: "Spoken script. Must fit the selected duration budget and speech speed." },
890
+ voiceId: { type: "string", minLength: 1, maxLength: 150, pattern: "^[A-Za-z0-9_-]+$", description: "HeyGen voice ID for the narration." },
891
+ speed: { type: "number", minimum: 0.5, maximum: 1.5, default: 1, description: "Speech speed multiplier." },
892
+ targetDuration: { type: "integer", minimum: 5, maximum: 120, default: 15, description: "Maximum script duration budget in seconds." },
893
+ performancePreset: { type: "string", enum: ["natural", "professional", "energetic", "friendly", "presenter", "storyteller"], default: "professional", description: "Avatar performance style." },
894
+ expressiveness: { type: "string", enum: ["low", "medium", "high"], description: "Optional expression intensity override." },
895
+ motionPrompt: { type: "string", maxLength: 500, description: "Optional motion instructions overriding the preset." },
896
+ backgroundMode: { type: "string", enum: ["original", "color"], default: "original", description: "Preserve the portrait background or use a solid color." },
897
+ backgroundColor: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", default: "#111827", description: "Solid background color when backgroundMode is color." },
898
+ captions: { type: "boolean", default: false, description: "Whether to add captions." },
899
+ title: { type: "string", maxLength: 100, description: "Optional video title." },
900
+ resolution: { type: "string", enum: ["720p", "1080p"], default: "1080p", description: "Output resolution." },
901
+ aspectRatio: { type: "string", enum: ["9:16", "1:1", "16:9"], default: "9:16", description: "Output aspect ratio." }
902
+ },
903
+ required: ["image", "script", "voiceId"]
904
+ }
905
+ };
906
+ const GENERATE_JEWELLERY_RATE_POSTER_TOOL = {
907
+ name: "generate_jewellery_rate_poster",
908
+ description: "Generates a branded gold and silver rate poster. Synchronous: returns the generated image for inline display. Rates are supplied by the caller, not fetched from a market feed.",
909
+ inputSchema: {
910
+ type: "object",
911
+ properties: {
912
+ scenePrompt: { type: "string", description: "Poster scene, background, and visual style." },
913
+ productImage: { type: "string", description: "Optional jewelry image URL, data URI, or local file path." },
914
+ logoImage: { type: "string", description: "Optional brand logo URL, data URI, or local file path." },
915
+ goldRate24k: { type: "string", description: "24K gold rate text, including currency and units." },
916
+ goldRate22k: { type: "string", description: "22K gold rate text, including currency and units." },
917
+ goldRate18k: { type: "string", description: "18K gold rate text, including currency and units." },
918
+ goldRate14k: { type: "string", description: "14K gold rate text, including currency and units." },
919
+ silverRate: { type: "string", description: "Silver rate text, including currency and units." },
920
+ date: { type: "string", description: "Date to display on the poster." },
921
+ brandName: { type: "string", description: "Jewelry business name." },
922
+ tagLine: { type: "string", description: "Optional brand tagline." },
923
+ footerText: { type: "string", description: "Optional footer or disclaimer." },
924
+ address: { type: "string", description: "Business address." },
925
+ phoneNumber: { type: "string", description: "Business contact number." },
926
+ model: { type: "string", description: "Image model slug; use list_image_models to discover models." },
927
+ resolution: { type: "string", description: "Resolution supported by the selected model (1K, 2K, or 4K)." },
928
+ aspectRatio: { type: "string", default: "1:1", description: "Aspect ratio supported by the selected model." }
929
+ },
930
+ required: ["scenePrompt"]
931
+ }
564
932
  };
565
933
  // 20. Check Video Job Status (Polling)
566
934
  const CHECK_JOB_STATUS_TOOL = {
567
935
  name: "check_video_job_status",
568
- description: "Checks the real-time status of an asynchronous video generation job. Call this repeatedly (every 10-30 seconds) until the job status is 'completed' or 'failed'.",
936
+ description: "Checks the real-time status of an asynchronous video generation job. Call this repeatedly (every 10-30 seconds) until the job status is 'completed', 'failed', or 'cancelled'.",
569
937
  inputSchema: {
570
938
  type: "object",
571
939
  properties: {
@@ -578,15 +946,21 @@ const CHECK_JOB_STATUS_TOOL = {
578
946
  server.setRequestHandler(ListToolsRequestSchema, async () => {
579
947
  return {
580
948
  tools: [
949
+ GENERATE_JEWELLERY_RATE_POSTER_TOOL,
581
950
  GENERATE_PRODUCT_PHOTO_TOOL,
582
951
  GENERATE_LOGO_TOOL,
583
952
  TRY_ON_JEWELRY_TOOL,
584
953
  TRY_ON_APPAREL_TOOL,
585
954
  TRY_ON_PRODUCT_TOOL,
586
955
  GENERATE_FESTIVAL_POST_TOOL,
956
+ BUILD_HUMAN_TOOL,
587
957
  GENERATE_YOUTUBE_THUMBNAIL_TOOL,
588
958
  GENERATE_PASSPORT_PHOTO_TOOL,
589
959
  SKETCH_TO_REAL_TOOL,
960
+ EDIT_PROFESSIONAL_PHOTO_TOOL,
961
+ EDIT_NANO_BANANA_TOOL,
962
+ GENERATE_BLOG_IMAGE_TOOL,
963
+ GENERATE_BABY_MILESTONE_TOOL,
590
964
  UPSCALE_IMAGE_TOOL,
591
965
  GENERATE_QR_CODE_TOOL,
592
966
  GENERATE_QR_CODE_SIMPLE_TOOL,
@@ -597,6 +971,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
597
971
  GENERATE_FESTIVAL_VIDEO_TOOL,
598
972
  GENERATE_JEWELRY_VIDEO_TOOL,
599
973
  GENERATE_LOGO_VIDEO_TOOL,
974
+ GENERATE_STORY_VIDEO_TOOL,
975
+ GENERATE_TALKING_AVATAR_TOOL,
600
976
  CHECK_JOB_STATUS_TOOL,
601
977
  ],
602
978
  };
@@ -606,6 +982,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
606
982
  try {
607
983
  const { name, arguments: rawArgs } = request.params;
608
984
  const args = rawArgs || {};
985
+ if (name === 'generate_jewellery_rate_poster') {
986
+ const response = await apiClient('/image/jewellery-rate-poster', {
987
+ method: 'POST',
988
+ body: JSON.stringify({ ...args, productImage: resolveImageInput(args.productImage),
989
+ logoImage: resolveImageInput(args.logoImage), outputResult: 'base64' }),
990
+ });
991
+ return formatImageToolResult(response, 'Jewellery Rate Poster Generated');
992
+ }
609
993
  // ── 1. Product Photography (synchronous) ──────────────────────────────────
610
994
  if (name === 'generate_product_photo') {
611
995
  const payload = {
@@ -690,13 +1074,30 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
690
1074
  });
691
1075
  return formatImageToolResult(response, 'Festival Post Generated');
692
1076
  }
693
- // ── 7. YouTube Thumbnail (synchronous) ────────────────────────────────────
1077
+ // ── 7. Human Builder (synchronous) ────────────────────────────────────────
1078
+ if (name === 'build_human') {
1079
+ const payload = {
1080
+ ...args,
1081
+ referenceImages: Array.isArray(args.referenceImages)
1082
+ ? args.referenceImages.map((img) => typeof img === 'string'
1083
+ ? resolveImageInput(img)
1084
+ : resolveImageInput(img?.dataUrl || img?.path || img?.url))
1085
+ : undefined,
1086
+ };
1087
+ const response = await apiClient('/image/human-builder', {
1088
+ method: 'POST',
1089
+ body: JSON.stringify(payload),
1090
+ });
1091
+ return formatImageToolResult(response, 'AI Human Model Generated');
1092
+ }
1093
+ // ── 8. YouTube Thumbnail (synchronous) ────────────────────────────────────
694
1094
  if (name === 'generate_youtube_thumbnail') {
695
1095
  const payload = {
696
1096
  ...args,
697
1097
  personImage: resolveImageInput(args.personImage),
698
1098
  backgroundImage: resolveImageInput(args.backgroundImage),
699
1099
  logoImage: resolveImageInput(args.logoImage),
1100
+ referenceImage: resolveImageInput(args.referenceImage),
700
1101
  };
701
1102
  const response = await apiClient('/image/youtube-thumbnail-generator', {
702
1103
  method: 'POST',
@@ -709,6 +1110,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
709
1110
  const payload = {
710
1111
  ...args,
711
1112
  photoDataUri: resolveImageInput(args.photoDataUri),
1113
+ referenceImage: resolveImageInput(args.referenceImage),
712
1114
  };
713
1115
  const response = await apiClient('/image/passport-photo', {
714
1116
  method: 'POST',
@@ -730,7 +1132,72 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
730
1132
  });
731
1133
  return formatImageToolResult(response, 'Sketch-to-Real Image Generated');
732
1134
  }
733
- // ── 10. Upscale Image (synchronous) ───────────────────────────────────────
1135
+ // ── 10. Professional Photography Editor (synchronous) ─────────────────────
1136
+ if (name === 'edit_professional_photo') {
1137
+ let resolvedImages = args.images ? resolveImagesArray(args.images) : [];
1138
+ if (resolvedImages.length === 0 && args.image) {
1139
+ const single = resolveImageInput(args.image);
1140
+ if (single) {
1141
+ resolvedImages = [{ dataUrl: single }];
1142
+ }
1143
+ }
1144
+ const payload = {
1145
+ ...args,
1146
+ images: resolvedImages,
1147
+ referenceImage: resolveImageInput(args.referenceImage),
1148
+ };
1149
+ const response = await apiClient('/image/professional-photography-editor', {
1150
+ method: 'POST',
1151
+ body: JSON.stringify(payload),
1152
+ });
1153
+ return formatImageToolResult(response, 'Professional Photo Generated');
1154
+ }
1155
+ // ── 11. Nano Banana Image Editor (synchronous) ────────────────────────────
1156
+ if (name === 'edit_nano_banana') {
1157
+ let resolvedImages = args.images ? resolveImagesArray(args.images) : [];
1158
+ if (resolvedImages.length === 0 && args.image) {
1159
+ const single = resolveImageInput(args.image);
1160
+ if (single) {
1161
+ resolvedImages = [{ dataUrl: single }];
1162
+ }
1163
+ }
1164
+ const payload = {
1165
+ ...args,
1166
+ images: resolvedImages,
1167
+ referenceImage: resolveImageInput(args.referenceImage),
1168
+ };
1169
+ const response = await apiClient('/image/nano-banana-editor', {
1170
+ method: 'POST',
1171
+ body: JSON.stringify(payload),
1172
+ });
1173
+ return formatImageToolResult(response, 'Nano Banana Image Generated');
1174
+ }
1175
+ // ── 12. Blog Image Generator (synchronous) ────────────────────────────────
1176
+ if (name === 'generate_blog_image') {
1177
+ const payload = {
1178
+ ...args,
1179
+ referenceImage: resolveImageInput(args.referenceImage),
1180
+ };
1181
+ const response = await apiClient('/image/blog-image-generator', {
1182
+ method: 'POST',
1183
+ body: JSON.stringify(payload),
1184
+ });
1185
+ return formatImageToolResult(response, 'Blog Image Generated');
1186
+ }
1187
+ // ── 13. Baby Milestone Generator (synchronous) ───────────────────────────
1188
+ if (name === 'generate_baby_milestone') {
1189
+ const payload = {
1190
+ ...args,
1191
+ photoDataUri: resolveImageInput(args.photoDataUri),
1192
+ referenceImage: resolveImageInput(args.referenceImage),
1193
+ };
1194
+ const response = await apiClient('/image/baby-milestone-generator', {
1195
+ method: 'POST',
1196
+ body: JSON.stringify(payload),
1197
+ });
1198
+ return formatImageToolResult(response, 'Baby Milestone Photo Generated');
1199
+ }
1200
+ // ── 12. Upscale Image (synchronous) ───────────────────────────────────────
734
1201
  if (name === 'upscale_image') {
735
1202
  const payload = {
736
1203
  ...args,
@@ -739,6 +1206,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
739
1206
  const response = await apiClient('/image/upscale-image', {
740
1207
  method: 'POST',
741
1208
  body: JSON.stringify(payload),
1209
+ signal: AbortSignal.timeout(12 * 60 * 1000),
742
1210
  });
743
1211
  return formatImageToolResult(response, 'Image Upscaled Successfully');
744
1212
  }
@@ -798,14 +1266,27 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
798
1266
  generate_apparel_video: '/apparel-video-generation',
799
1267
  generate_festival_video: '/festival-video-generation',
800
1268
  generate_jewelry_video: '/jewelry-video-generation',
801
- generate_logo_video: '/logo-video-generation'
1269
+ generate_logo_video: '/logo-video-generation',
1270
+ generate_story_video: '/story-teller-generation',
1271
+ generate_talking_avatar: '/ai/talking-avatar/generate'
802
1272
  };
803
1273
  if (videoEndpoints[name]) {
804
- const payload = {
1274
+ const optionalImage = (input) => typeof input === 'string' && input.trim()
1275
+ ? resolveImageInput(input) : undefined;
1276
+ const references = Array.isArray(args.referenceImages)
1277
+ ? args.referenceImages.map((reference) => ({
1278
+ ...reference, image: resolveImageInput(reference.image)
1279
+ })) : undefined;
1280
+ const avatarImage = name === 'generate_talking_avatar' ? optionalImage(args.image) : undefined;
1281
+ if (name === 'generate_talking_avatar' && !/^data:image\/(png|jpeg|webp);base64,/.test(avatarImage || '')) {
1282
+ throw new Error('Talking Avatar requires a PNG, JPEG, or WebP portrait as a local file path or base64 data URI.');
1283
+ }
1284
+ const payload = name === 'generate_talking_avatar' ? { ...args, image: avatarImage } : {
805
1285
  ...args,
806
- mainImage: resolveImageInput(args.mainImage),
807
- startImage: resolveImageInput(args.startImage),
808
- endImage: resolveImageInput(args.endImage),
1286
+ mainImage: optionalImage(args.mainImage),
1287
+ startImage: optionalImage(args.startImage),
1288
+ endImage: optionalImage(args.endImage),
1289
+ referenceImages: references,
809
1290
  };
810
1291
  const response = await apiClient(videoEndpoints[name], {
811
1292
  method: 'POST',
@@ -838,6 +1319,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
838
1319
  text += `\nβœ… **Video Ready:** [Watch / Download Video](${job.result.videoUrl})\n`;
839
1320
  text += `\nπŸ“ **Gallery:** View in your [CodingMantra Gallery](https://codingmantra.com/my-gallery)`;
840
1321
  }
1322
+ else if (job.status === 'cancelled') {
1323
+ text += `\nJob cancelled. No further polling is needed.`;
1324
+ }
841
1325
  else if (job.status === 'failed') {
842
1326
  text += `\n❌ **Job Failed:** ${job.error || 'Unknown error occurred during generation.'}\n`;
843
1327
  text += `Your credits have been refunded automatically.`;
@@ -862,7 +1346,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
862
1346
  async function run() {
863
1347
  const transport = new StdioServerTransport();
864
1348
  await server.connect(transport);
865
- console.error("[CodingMantra MCP] Server v0.2.0 initialized and running on stdio (20 tools active)");
1349
+ console.error("[CodingMantra MCP] Server v0.2.2 initialized and running on stdio (28 tools active)");
866
1350
  }
867
1351
  run().catch((error) => {
868
1352
  console.error("Fatal error running CodingMantra MCP server:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingmantra/mcp-server",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Official Model Context Protocol (MCP) Server for CodingMantra AI Generation Tools",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -16,10 +16,11 @@
16
16
  "build": "tsc",
17
17
  "prepublishOnly": "npm run build",
18
18
  "start": "node build/index.js",
19
- "dev": "tsc --watch"
19
+ "dev": "tsc --watch",
20
+ "test": "npm run build && node --test tests/server.test.mjs"
20
21
  },
21
22
  "dependencies": {
22
- "@modelcontextprotocol/sdk": "^1.0.1",
23
+ "@modelcontextprotocol/sdk": "1.30.0",
23
24
  "dotenv": "17.4.2",
24
25
  "zod": "^3.23.8"
25
26
  },