Skip to main content
Glama

run_workflow

Execute Fal.ai workflows like the sdxl-sticker pipeline by providing workflow ID and input parameters to generate AI images.

Instructions

Run a Fal.ai workflow (e.g., sdxl-sticker pipeline)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflow_idYesThe workflow ID
inputYesInput parameters for the workflow
streamNoWhether to stream workflow events

Implementation Reference

  • Switch case handling the execution of the 'run_workflow' tool. Parses input using RunWorkflowSchema, calls fal.stream or fal.subscribe on the workflow_id with input params, collects stream events or full result, and returns as formatted text content.
    case "run_workflow": {
      const params = RunWorkflowSchema.parse(args);
      
      if (params.stream) {
        const stream = await fal.stream(params.workflow_id, {
          input: params.input,
        });
        
        const events: any[] = [];
        for await (const event of stream) {
          events.push({
            type: event.type,
            data: event.data,
          });
        }
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(events, null, 2),
            },
          ],
        };
      } else {
        const result = await fal.subscribe(params.workflow_id, {
          input: params.input,
          logs: true,
        });
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the run_workflow tool: workflow_id (required string), input (object), stream (optional boolean).
    const RunWorkflowSchema = z.object({
      workflow_id: z.string().describe("The workflow ID (e.g., 'workflows/fal-ai/sdxl-sticker')"),
      input: z.record(z.any()).describe("Input parameters for the workflow"),
      stream: z.boolean().default(false).optional().describe("Whether to stream workflow events"),
    });
  • src/index.ts:161-183 (registration)
    Tool registration in the ListTools response, including name, description, and JSON inputSchema matching the Zod schema.
    {
      name: "run_workflow",
      description: "Run a Fal.ai workflow (e.g., sdxl-sticker pipeline)",
      inputSchema: {
        type: "object",
        properties: {
          workflow_id: {
            type: "string",
            description: "The workflow ID",
          },
          input: {
            type: "object",
            description: "Input parameters for the workflow",
          },
          stream: {
            type: "boolean",
            description: "Whether to stream workflow events",
            default: false,
          },
        },
        required: ["workflow_id", "input"],
      },
    },

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

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/gravicity-archive/fal-mcp-server'

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