Skip to main content
Glama

list_workflows

Discover and list workflow files (.json and .dsl) in a directory using glob patterns for filtering, returning file details like name, size, and modification time.

Instructions

List workflow files in a directory.

Discovers workflow files (.json and .dsl) in the specified directory. Supports glob patterns for filtering.

Args: directory: Directory to search (default: "workflows") pattern: Glob pattern for filtering (default: "*" for all files)

Returns: List of workflow info dicts with name, size, modified time

Examples: list_workflows() list_workflows("workflows", "*.json") list_workflows("../dsl/examples/dsl")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNoworkflows
patternNo*

Implementation Reference

  • The handler function for the 'list_workflows' tool. It is registered via the @mcp.tool decorator and implements logic to discover and list workflow files (.json and .dsl) in a specified directory using glob patterns, with path validation for security.
    @mcp.tool def list_workflows(directory: str = "workflows", pattern: str = "*") -> list[dict]: """List workflow files in a directory. Discovers workflow files (.json and .dsl) in the specified directory. Supports glob patterns for filtering. Args: directory: Directory to search (default: "workflows") pattern: Glob pattern for filtering (default: "*" for all files) Returns: List of workflow info dicts with name, size, modified time Examples: list_workflows() list_workflows("workflows", "*.json") list_workflows("../dsl/examples/dsl") """ try: base = Path(directory) # Allow listing in dsl/examples without validation if "examples" in str(directory): search_path = base else: search_path = validate_path(str(base)) if not search_path.exists(): raise ToolError(f"Directory not found: {directory}") # Find workflow files workflows = [] for ext in [".json", ".dsl"]: for path in search_path.glob(f"{pattern}{ext}"): if path.is_file(): stat = path.stat() workflows.append({ "name": path.name, "path": str(path), "size": stat.st_size, "modified": stat.st_mtime, "format": ext[1:] # Remove leading dot }) # Sort by name workflows.sort(key=lambda w: w["name"]) return workflows except Exception as e: raise ToolError(f"Error listing workflows: {e}")

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/christian-byrne/comfy-mcp'

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