replicate-flux-mcp

by awkoy
Verified
import { z } from "zod"; export const createPredictionSchema = { prompt: z.string().min(1).describe("Prompt for generated image"), seed: z .number() .int() .optional() .describe("Random seed. Set for reproducible generation"), go_fast: z .boolean() .default(true) .describe( "Run faster predictions with model optimized for speed (currently fp8 quantized); disable to run in original bf16" ), megapixels: z .enum(["1", "0.25"]) .default("1") .describe("Approximate number of megapixels for generated image"), num_outputs: z .number() .int() .min(1) .max(4) .default(1) .describe("Number of outputs to generate"), aspect_ratio: z .enum([ "1:1", "16:9", "21:9", "3:2", "2:3", "4:5", "5:4", "3:4", "4:3", "9:16", "9:21", ]) .default("1:1") .describe("Aspect ratio for the generated image"), output_format: z .enum(["webp", "jpg", "png"]) .default("webp") .describe("Format of the output images"), output_quality: z .number() .int() .min(0) .max(100) .default(80) .describe( "Quality when saving the output images, from 0 to 100. 100 is best quality, 0 is lowest quality. Not relevant for .png outputs" ), num_inference_steps: z .number() .int() .min(1) .max(4) .default(4) .describe( "Number of denoising steps. 4 is recommended, and lower number of steps produce lower quality outputs, faster." ), disable_safety_checker: z .boolean() .default(false) .describe("Disable safety checker for generated images."), }; const createPredictionObjectSchema = z.object(createPredictionSchema); export type CreatePredictionParams = z.infer< typeof createPredictionObjectSchema >; export const imageGenerationSchema = { ...createPredictionSchema, support_image_mcp_response_type: z .boolean() .default(true) .describe( "Disable if the image type is not supported in the response, if it's Cursor app for example" ), }; const imageGenerationObjectSchema = z.object(imageGenerationSchema); export type ImageGenerationParams = z.infer<typeof imageGenerationObjectSchema>; export const svgGenerationSchema = { prompt: z.string().min(1).describe("Prompt for generated SVG"), size: z .enum([ "1024x1024", "1365x1024", "1024x1365", "1536x1024", "1024x1536", "1820x1024", "1024x1820", "1024x2048", "2048x1024", "1434x1024", "1024x1434", "1024x1280", "1280x1024", "1024x1707", "1707x1024", ]) .default("1024x1024") .describe("Size of the generated SVG"), style: z .enum(["any", "engraving", "line_art", "line_circuit", "linocut"]) .default("any") .describe("Style of the generated image."), }; const svgGenerationObjectSchema = z.object(svgGenerationSchema); export type SvgGenerationParams = z.infer<typeof svgGenerationObjectSchema>; export const predictionListSchema = { limit: z .number() .int() .min(1) .max(100) .default(50) .describe("Maximum number of predictions to return"), }; const predictionListObjectSchema = z.object(predictionListSchema); export type PredictionListParams = z.infer<typeof predictionListObjectSchema>; export const getPredictionSchema = { predictionId: z.string().min(1).describe("ID of the prediction to retrieve"), }; const getPredictionObjectSchema = z.object(getPredictionSchema); export type GetPredictionParams = z.infer<typeof getPredictionObjectSchema>;