run_workflow
Execute a workflow by specifying its ID to process data through the Unstructured API, returning the execution response.
Instructions
Run a specific workflow.
Args:
workflow_id: ID of the workflow to run
Returns:
String containing the response from the workflow execution
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow_id | Yes |
Implementation Reference
- uns_mcp/server.py:391-410 (handler)The main handler and registration for the 'run_workflow' tool. This async function is decorated with @mcp.tool() which registers it with the MCP server. It executes the tool logic by calling the UnstructuredClient's run_workflow_async method using the provided workflow_id, handling exceptions and returning the response or error message.@mcp.tool() async def run_workflow(ctx: Context, workflow_id: str) -> str: """Run a specific workflow. Args: workflow_id: ID of the workflow to run Returns: String containing the response from the workflow execution """ client = ctx.request_context.lifespan_context.client try: response = await client.workflows.run_workflow_async( request=RunWorkflowRequest(workflow_id=workflow_id), ) return f"Workflow execution initiated: {response.raw_response}" except Exception as e: return f"Error running workflow: {str(e)}"