Skip to main content
Glama

replicate-flux-mcp

predictionList.ts1.1 kB
import { PredictionListParams } from "../types/index.js"; import { replicate } from "../services/replicate.js"; import { handleError } from "../utils/error.js"; import { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; export const registerPredictionListTool = async ({ limit, }: PredictionListParams): Promise<CallToolResult> => { try { const predictions = []; for await (const page of replicate.paginate(replicate.predictions.list)) { predictions.push(...page); if (predictions.length >= limit) { break; } } const limitedPredictions = predictions.slice(0, limit); const totalPages = Math.ceil(predictions.length / limit); return { content: [ { type: "text", text: `Found ${limitedPredictions.length} predictions (showing ${limitedPredictions.length} of ${predictions.length} total, page 1 of ${totalPages})`, }, { type: "text", text: JSON.stringify(limitedPredictions, null, 2), }, ], }; } catch (error) { handleError(error); } };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/awkoy/replicate-flux-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server