Skip to main content
Glama

get_workflow_template

Retrieve pre-built workflow templates for ComfyUI automation, including Flux Dev for higher quality or Flux Schnell for faster image generation, ready for modification and execution.

Instructions

Get a pre-built workflow template.

Args: template_name: One of: - 'empty': Empty workflow - 'fal-flux-dev': Flux Dev via fal.ai (higher quality) - 'fal-flux-schnell': Flux Schnell via fal.ai (faster) Returns a workflow dict that can be modified and executed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_nameYesTemplate: 'fal-flux-dev', 'fal-flux-schnell', 'empty'

Implementation Reference

  • The handler function for the 'get_workflow_template' tool. It retrieves a predefined workflow template by name from the TEMPLATES dictionary, validates the template exists, and returns a deep copy of it. The function is decorated with @mcp.tool(), defining the tool schema via Pydantic Field and docstring.
    def get_workflow_template( template_name: str = Field( description="Template: 'fal-flux-dev', 'fal-flux-schnell', 'empty'" ), ctx: Context = None, ) -> dict: """Get a pre-built workflow template. Args: template_name: One of: - 'empty': Empty workflow - 'fal-flux-dev': Flux Dev via fal.ai (higher quality) - 'fal-flux-schnell': Flux Schnell via fal.ai (faster) Returns a workflow dict that can be modified and executed. """ if ctx: ctx.info(f"Loading template: {template_name}") if template_name not in TEMPLATES: return ErrorResponse.not_found( f"Template '{template_name}'", suggestion=f"Available: {list(TEMPLATES.keys())}", ).model_dump() # Return a copy to avoid modifying the original return json.loads(json.dumps(TEMPLATES[template_name]))
  • Predefined workflow templates dictionary used by get_workflow_template to provide ready-to-use API-format workflows for common tasks like Flux image generation via fal.ai.
    TEMPLATES = { "empty": {}, "fal-flux-dev": { "1": { "class_type": "RemoteCheckpointLoader_fal", "inputs": {"ckpt_name": "fal-ai/flux/dev"}, }, "2": {"class_type": "StringInput_fal", "inputs": {"text": "A beautiful landscape"}}, "3": {"class_type": "IntegerInput_fal", "inputs": {"value": 1024}}, "4": {"class_type": "IntegerInput_fal", "inputs": {"value": 1024}}, "5": {"class_type": "IntegerInput_fal", "inputs": {"value": 28}}, "6": {"class_type": "FloatInput_fal", "inputs": {"value": 3.5}}, "7": { "class_type": "SaveImage_fal", "inputs": {"filename_prefix": "flux_output", "images": ["1", 0]}, }, }, "fal-flux-schnell": { "1": { "class_type": "RemoteCheckpointLoader_fal", "inputs": {"ckpt_name": "fal-ai/flux/schnell"}, }, "2": {"class_type": "StringInput_fal", "inputs": {"text": "A beautiful landscape"}}, "3": { "class_type": "SaveImage_fal", "inputs": {"filename_prefix": "flux_schnell", "images": ["1", 0]}, }, }, }
  • Call to register_workflow_tools within register_all_tools, which registers the get_workflow_template tool (and other workflow tools) with the MCP server.
    register_workflow_tools(mcp)
  • Invocation of register_all_tools during server initialization, which ultimately registers the get_workflow_template tool.
    register_all_tools(mcp)

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/IO-AtelierTech/comfyui-mcp'

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