get_job
Retrieve an agent job by its ID to check status, view details, or monitor progress in the Agent Jobs system.
Instructions
Retrieves an agent job by its ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | The unique identifier of the job you want to retrieve. Example: 'job-12345'. | |
| org_id | No | The organization ID. Example: 'aiconnect'. |
Implementation Reference
- src/tools/get_job.ts:27-69 (handler)The handler function that executes the 'get_job' tool logic: extracts job_id and optional org_id, constructs API endpoint, fetches job data via agentJobsClient, formats details with formatJobDetails, and returns formatted text content or error.async (params) => { mcpDebugger.toolCall("get_job", params); const { job_id } = params; const endpoint = `/services/agent-jobs/${job_id}${params.org_id ? `?org_id=${params.org_id}` : ''}`; mcpDebugger.debug("Built endpoint", { endpoint, job_id, org_id: params.org_id }); try { const job = await withTiming( () => agentJobsClient.get(endpoint), "get_job API call" ); mcpDebugger.debug("Raw API response", { job }); const result = { content: [ { type: 'text' as const, text: formatJobDetails(job) } ] }; mcpDebugger.toolResponse("get_job", { jobId: job_id, resultLength: result.content[0].text.length }); return result; } catch (error: any) { mcpDebugger.toolError("get_job", error); return { content: [ { type: 'text' as const, text: `Error getting job: ${error.message}` } ] }; }
- src/tools/get_job.ts:10-26 (schema)Input schema for the 'get_job' tool using Zod: requires job_id (string), optional org_id (string), with descriptions.{ description: 'Retrieves an agent job by its ID.', annotations: { title: 'Get Agent Job' }, inputSchema: { job_id: z.string({ description: "The unique identifier of the job you want to retrieve. Example: 'job-12345'." }), org_id: z .string({ description: "The organization ID. Example: 'aiconnect'." }) .optional() } },
- src/tools/get_job.ts:8-71 (registration)Registration of the 'get_job' tool on the MCP server, including name, schema, and handler reference.server.registerTool( 'get_job', { description: 'Retrieves an agent job by its ID.', annotations: { title: 'Get Agent Job' }, inputSchema: { job_id: z.string({ description: "The unique identifier of the job you want to retrieve. Example: 'job-12345'." }), org_id: z .string({ description: "The organization ID. Example: 'aiconnect'." }) .optional() } }, async (params) => { mcpDebugger.toolCall("get_job", params); const { job_id } = params; const endpoint = `/services/agent-jobs/${job_id}${params.org_id ? `?org_id=${params.org_id}` : ''}`; mcpDebugger.debug("Built endpoint", { endpoint, job_id, org_id: params.org_id }); try { const job = await withTiming( () => agentJobsClient.get(endpoint), "get_job API call" ); mcpDebugger.debug("Raw API response", { job }); const result = { content: [ { type: 'text' as const, text: formatJobDetails(job) } ] }; mcpDebugger.toolResponse("get_job", { jobId: job_id, resultLength: result.content[0].text.length }); return result; } catch (error: any) { mcpDebugger.toolError("get_job", error); return { content: [ { type: 'text' as const, text: `Error getting job: ${error.message}` } ] }; } } );