Skip to main content
Glama
Unstructured-IO

Unstructured API MCP Server

Official

update_workflow

Modify an existing workflow configuration by updating its name, schedule, source, destination, or workflow nodes to adapt to changing data processing needs.

Instructions

Update an existing workflow.

Args:
    workflow_id: ID of the workflow to update
    workflow_config: A Typed Dictionary containing required fields (destination_id,
    name, source_id, workflow_type) and non-required fields (schedule, and workflow_nodes)

Returns:
    String containing the updated workflow information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflow_idYes
workflow_configYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler for the 'update_workflow' tool. This async function is decorated with @mcp.tool(), which registers it as an MCP tool named 'update_workflow'. It takes workflow_id and workflow_config, uses UnstructuredClient to update the workflow, and returns formatted info or error.
    @mcp.tool()
    # WorkflowNode.settings. It can be safely deleted when typing is added.
    async def update_workflow(
        ctx: Context,
        workflow_id: str,
        workflow_config: CreateWorkflowTypedDict,
    ) -> str:
        """Update an existing workflow.
    
        Args:
            workflow_id: ID of the workflow to update
            workflow_config: A Typed Dictionary containing required fields (destination_id,
            name, source_id, workflow_type) and non-required fields (schedule, and workflow_nodes)
    
        Returns:
            String containing the updated workflow information
        """
        client = ctx.request_context.lifespan_context.client
    
        try:
            workflow = UpdateWorkflow(**workflow_config)
            response = await client.workflows.update_workflow_async(
                request=UpdateWorkflowRequest(workflow_id=workflow_id, update_workflow=workflow),
            )
    
            info = response.workflow_information
            return await get_workflow_info(ctx, info.id)
        except Exception as e:
            return f"Error updating workflow: {str(e)}"
  • The @mcp.tool() decorator registers the update_workflow function as an MCP tool.
    @mcp.tool()
  • Helper function called by update_workflow (and others) to retrieve and format detailed workflow information after update.
    async def get_workflow_info(ctx: Context, workflow_id: str) -> str:
        """Get detailed information about a specific workflow.
    
        Args:
            workflow_id: ID of the workflow to get information for
    
        Returns:
            String containing the workflow information
        """
        client = ctx.request_context.lifespan_context.client
    
        response = await client.workflows.get_workflow_async(
            request=GetWorkflowRequest(workflow_id=workflow_id),
        )
    
        info: WorkflowInformation = response.workflow_information
    
        result = ["Workflow Information:"]
        result.append(f"Name: {info.name}")
        result.append(f"ID: {info.id}")
        result.append(f"Status: {info.status.value}")
        if info.workflow_type is None:
            result.append("Type: Undefined")
        else:
            result.append(f"Type: {info.workflow_type.value}")
    
        result.append("\nSources:")
        for source in info.sources:
            result.append(f"  - {source}")
    
        if info.workflow_type and info.workflow_type == WorkflowType.CUSTOM.value:
            result.append("\nWorkflow Nodes:")
            for node in info.workflow_nodes:
                result.append(f"  - {node.name} (Type: {node.type.value}) (Subtype: {node.subtype}):")
                if node.settings:
                    result.append(f"    Settings: {json.dumps(node.settings, indent=8)}")
    
        result.append("\nDestinations:")
        for destination in info.destinations:
            result.append(f"  - {destination}")
    
        result.append("\nSchedule:")
        if info.schedule.crontab_entries:
            for crontab_entry in info.schedule.crontab_entries:
                result.append(f"  - {crontab_entry.cron_expression}")
        else:
            result.append("  - No crontab entry")
    
        return "\n".join(result)
  • Import of CreateWorkflowTypedDict, used as type annotation for workflow_config parameter, defining the input schema structure for the tool.
    from unstructured_client.models.shared.createworkflow import CreateWorkflowTypedDict
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an update operation but doesn't mention permissions required, whether changes are reversible, rate limits, or what happens to unspecified fields. The return value is vaguely described as 'String containing the updated workflow information' without format details, leaving significant behavioral gaps.

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

Conciseness4/5

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

The description is well-structured with clear sections for Args and Returns. Each sentence serves a purpose: stating the action, explaining parameters, and describing the return. While efficient, the parameter explanations could be slightly more detailed given the complexity of workflow_config.

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

Completeness3/5

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

Given the tool's complexity (mutation operation with nested configuration), no annotations, and an output schema exists (though not shown), the description is minimally adequate. It covers the basic action and parameter structure but lacks behavioral context, error handling, and detailed return format explanation that would make it complete for safe agent use.

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?

The description adds substantial value beyond the input schema, which has 0% description coverage. It explains that 'workflow_config' is a Typed Dictionary and lists required fields (destination_id, name, source_id, workflow_type) and optional fields (schedule, workflow_nodes). This clarifies parameter structure and requirements that aren't evident from the schema alone.

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 action ('Update') and resource ('an existing workflow'), making the purpose immediately understandable. However, it doesn't distinguish this tool from sibling tools like 'update_destination_connector' or 'update_source_connector' beyond the different resource type, missing explicit differentiation.

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 'create_workflow' or 'delete_workflow'. There's no mention of prerequisites (e.g., needing an existing workflow ID), error conditions, or typical use cases, leaving the agent with minimal contextual direction.

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/Unstructured-IO/UNS-MCP'

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