Skip to main content
Glama
Unstructured-IO

Unstructured API MCP Server

Official

list_jobs

Retrieve and filter processing jobs from the Unstructured API by workflow ID or status to monitor document automation tasks.

Instructions

List jobs via the Unstructured API.

Args:
    workflow_id: Optional workflow ID to filter by
    status: Optional job status to filter by

Returns:
    String containing the list of jobs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflow_idNo
statusNo

Implementation Reference

  • The handler function for the 'list_jobs' MCP tool. It is registered via the @mcp.tool() decorator and implements the logic to list jobs from the Unstructured API, optionally filtered by workflow_id and status, sorting by creation time and returning formatted job IDs.
    @mcp.tool()
    async def list_jobs(
        ctx: Context,
        workflow_id: Optional[str] = None,
        status: Optional[JobStatus | str] = None,
    ) -> str:
        """
        List jobs via the Unstructured API.
    
        Args:
            workflow_id: Optional workflow ID to filter by
            status: Optional job status to filter by
    
        Returns:
            String containing the list of jobs
        """
        client = ctx.request_context.lifespan_context.client
    
        request = ListJobsRequest(workflow_id=workflow_id, status=status)
    
        if status:
            try:
                status = JobStatus(status) if isinstance(status, str) else status
                request.status = status
            except KeyError:
                return f"Invalid job status: {status}"
    
        response = await client.jobs.list_jobs_async(request=request)
    
        # Sort jobs by name
        sorted_jobs = sorted(
            response.response_list_jobs,
            key=lambda job: job.created_at,
        )
    
        if not sorted_jobs:
            return "No Jobs found"
    
        # Format response
        result = ["Available Jobs by created time:"]
        for job in sorted_jobs:
            result.append(f"- JOB ID: {job.id}")
    
        return "\n".join(result)
  • Registration of the list_jobs tool using the @mcp.tool() decorator.
    @mcp.tool()
  • Helper usage in gather_workflows_details function extracting list_jobs response.
    jobs: list[JobInformation] = jobs.response_list_jobs
    sources: list[SourceConnectorInformation] = sources.response_list_sources
    destinations: list[DestinationConnectorInformation] = destinations.response_list_destinations
  • Import of ListJobsRequest model used for API request schema.
    ListJobsRequest,

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