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"],
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Run') but doesn't mention whether this is a read or write operation, what permissions are needed, if it's rate-limited, or what happens upon execution (e.g., asynchronous processing, costs). The example adds some context but lacks critical behavioral details for a tool with potential side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose with a clarifying example. There's no wasted verbiage or redundant information, making it easy for an agent to parse quickly and understand the tool's intent without unnecessary detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of running a workflow (likely involving asynchronous execution, side effects, or costs), the lack of annotations and output schema means the description should do more. It doesn't cover behavioral aspects like error handling, response format, or dependencies, leaving significant gaps for an agent to use this tool effectively in context with its siblings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the three parameters. The description doesn't add any semantic details beyond what's in the schema—it doesn't explain what a 'workflow ID' entails, what typical 'input parameters' might be, or when to use 'stream'. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Run') and resource ('a Fal.ai workflow'), with a specific example ('sdxl-sticker pipeline') that helps illustrate the type of workflow. However, it doesn't explicitly differentiate this tool from sibling tools like 'run_model' or 'generate_image', which might have overlapping functionality in AI image generation contexts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'run_model' or 'generate_image'. It mentions an example workflow but doesn't specify prerequisites, constraints, or scenarios where this tool is preferred over siblings, leaving the agent to infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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