get_job_check
Track the status of background jobs by job ID using this tool. Retrieve results for completed tasks, identify failures, or determine if a job is still processing, aborted, or unknown.
Instructions
Check the status and results of a job
Status can be:
- working: background job is currently in work or does not exist.
- success: background job was successfully finished.
- failed: background job failed for some reason (see message for more details).
- aborted: background job was aborted.
- unknown: unknown background job id. Available only when force is set to true for input request.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional) | |
| job_id | Yes | The ID of the job to get the status of |
Implementation Reference
- pdfco/mcp/tools/apis/job.py:37-54 (handler)The main handler function for the 'get_job_check' MCP tool. It is decorated with @mcp.tool() for registration and includes Pydantic Field annotations for input schema validation. The function delegates the core logic to the _get_job_status helper and returns a BaseResponse.@mcp.tool() async def get_job_check( job_id: str = Field(description="The ID of the job to get the status of"), api_key: str = Field( description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)", default="", ), ) -> BaseResponse: """ Check the status and results of a job Status can be: - working: background job is currently in work or does not exist. - success: background job was successfully finished. - failed: background job failed for some reason (see message for more details). - aborted: background job was aborted. - unknown: unknown background job id. Available only when force is set to true for input request. """ return await _get_job_status(job_id, api_key)
- pdfco/mcp/tools/apis/job.py:10-35 (helper)Internal helper function that performs the HTTP POST request to the PDF.co API endpoint '/v1/job/check' to retrieve the job status, handling the response and errors, and constructing the BaseResponse object.async def _get_job_status(job_id: str, api_key: str = "") -> BaseResponse: """ Internal helper function to check job status without MCP tool decoration """ try: async with PDFCoClient(api_key=api_key) as client: response = await client.post( "/v1/job/check", json={ "jobId": job_id, }, ) json_data = response.json() return BaseResponse( status=json_data["status"], content=json_data, credits_used=json_data.get("credits"), credits_remaining=json_data.get("remainingCredits"), tips="You can download the result if status is success", ) except Exception as e: return BaseResponse( status="error", content=str(e), )
- pdfco/mcp/tools/apis/job.py:5-6 (schema)Import of BaseResponse model used for output schema of the tool.from pdfco.mcp.models import BaseResponse