Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ func geminiGenerateContentHandler(client *genai.Client, ctx context.Context, req
aspectRatio = strings.TrimSpace(ar)
}

// No-default policy (intentional): unlike mcp-imagen-go, image_size is not
// registered with a DefaultString. When unset it stays empty and is dropped by
// omitempty, so the model applies its own default (currently 1K). This is a
// deliberate passthrough choice so the tool never asserts a size the model may
// not support; keep it defaulting to the empty string here.
imageSize := ""
if is, ok := request.GetArguments()["image_size"].(string); ok && strings.TrimSpace(is) != "" {
imageSize = strings.TrimSpace(is)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func main() {
mcp.WithString("prompt", mcp.Required(), mcp.Description("The text prompt for content generation.")),
mcp.WithString("model", mcp.DefaultString("gemini-3.1-flash-image"), mcp.Description(common.BuildGeminiImageModelDescription())),
mcp.WithString("aspect_ratio", mcp.DefaultString("1:1"), mcp.Description("Aspect ratio of the generated images. Note: supported aspect ratios are model-dependent.")),
mcp.WithString("image_size", mcp.Description("Optional. Size of the generated images: 1K, 2K, or 4K. Defaults to 1K when unset. Note: supported sizes are model-dependent.")),
mcp.WithString("image_size", mcp.Description("Optional. Size of the generated images: 1K, 2K, or 4K. When unset, the model's default (currently 1K) applies. Note: supported sizes are model-dependent.")),
mcp.WithArray("images", mcp.Description("Optional. A list of local file paths or GCS URIs for input images."), mcp.Items(map[string]any{"type": "string"})),
mcp.WithString("output_directory", mcp.Description("Optional. Local directory to save generated image(s) to.")),
mcp.WithString("gcs_bucket_uri", mcp.Description("Optional. GCS URI prefix to store generated images (e.g., your-bucket/outputs/).")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func nanobananaGenerateContentHandler(client *genai.Client, ctx context.Context,
aspectRatio = strings.TrimSpace(ar)
}

// No-default policy (intentional): unlike mcp-imagen-go, image_size is not
// registered with a DefaultString. When unset it stays empty and is dropped by
// omitempty, so the model applies its own default (currently 1K). This is a
// deliberate passthrough choice so the tool never asserts a size the model may
// not support; keep it defaulting to the empty string here.
imageSize := ""
if is, ok := request.GetArguments()["image_size"].(string); ok && strings.TrimSpace(is) != "" {
imageSize = strings.TrimSpace(is)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func main() {
mcp.WithString("prompt", mcp.Required(), mcp.Description("The text prompt for content generation.")),
mcp.WithString("model", mcp.DefaultString("gemini-3.1-flash-image"), mcp.Description(common.BuildGeminiImageModelDescription())),
mcp.WithString("aspect_ratio", mcp.DefaultString("1:1"), mcp.Description("Aspect ratio of the generated images. Note: supported aspect ratios are model-dependent.")),
mcp.WithString("image_size", mcp.Description("Optional. Size of the generated images: 1K, 2K, or 4K. Defaults to 1K when unset. Note: supported sizes are model-dependent.")),
mcp.WithString("image_size", mcp.Description("Optional. Size of the generated images: 1K, 2K, or 4K. When unset, the model's default (currently 1K) applies. Note: supported sizes are model-dependent.")),
mcp.WithArray("images", mcp.Description("Optional. A list of local file paths or GCS URIs for input media (images, videos, or PDFs)."), mcp.Items(map[string]any{"type": "string"})),
mcp.WithString("output_directory", mcp.Description("Optional. Local directory to save generated image(s) to.")),
mcp.WithString("gcs_bucket_uri", mcp.Description("Optional. GCS URI prefix to store generated images (e.g., your-bucket/outputs/).")),
Expand Down
Loading