Skip to main content
Glama
Unstructured-IO

Unstructured API MCP Server

Official

list_jobs

Retrieve and filter job listings in the Unstructured API by workflow ID or status. Simplify job management and monitoring by accessing relevant job data efficiently.

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
statusNo
workflow_idNo

Implementation Reference

  • The main handler function for the 'list_jobs' MCP tool. It uses the UnstructuredClient to fetch jobs optionally filtered by workflow_id and status, sorts them by creation time, and formats a list of job IDs for output.
    @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)
  • Imports from unstructured_client.models.operations including ListJobsRequest, which defines the request schema used internally by the list_jobs handler.
    from unstructured_client.models.operations import ( CancelJobRequest, CreateWorkflowRequest, DeleteWorkflowRequest, GetDestinationRequest, GetJobRequest, GetSourceRequest, GetWorkflowRequest, ListDestinationsRequest, ListJobsRequest, ListSourcesRequest, ListWorkflowsRequest, RunWorkflowRequest, UpdateWorkflowRequest, )
  • The @mcp.tool() decorator registers the list_jobs function as an MCP tool.
    @mcp.tool()

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