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*

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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}")
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool discovers files and supports glob patterns, but lacks details on permissions needed, error handling (e.g., invalid directory), rate limits, or whether it's a read-only operation (implied by 'list' but not explicit). Some behavioral context is given, but gaps remain for a tool with zero annotation coverage.

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 well-structured and front-loaded with the core purpose, followed by details on discovery, filtering, args, returns, and examples. Every sentence adds value without redundancy, and the bullet-like formatting enhances readability while maintaining brevity.

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

Completeness4/5

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

Given 2 parameters with 0% schema coverage and no annotations, the description does a solid job: it explains the tool's purpose, parameters, return values, and includes examples. Since an output schema exists (context signals indicate true), it doesn't need to detail return structure extensively. However, for a file-listing tool, it could mention pagination or sorting behavior, but overall it's fairly complete.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It adds meaningful context: 'directory' is where to search with a default, and 'pattern' is a glob filter with a default. This clarifies beyond the schema's basic string types, though it doesn't detail glob syntax or directory path requirements. With 0% schema coverage, this is good but not exhaustive.

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 tool's purpose: 'List workflow files in a directory' with specific file types (.json and .dsl). It distinguishes from siblings like 'list_templates' or 'list_official_templates' by focusing on workflow files, but doesn't explicitly contrast with 'get_workflow_info' or 'read_workflow' which might retrieve individual workflows.

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

Usage Guidelines3/5

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

The description implies usage when needing to discover workflow files with optional filtering via glob patterns. However, it doesn't explicitly state when to use this versus alternatives like 'list_templates' (for templates) or 'get_workflow_info' (for detailed info on a specific workflow), leaving some ambiguity in sibling tool selection.

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

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