Skip to main content
Glama

get_job

Retrieve specific agent job details by providing a unique job ID and organization ID for efficient monitoring and management of AI agent tasks.

Instructions

Retrieves an agent job by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_idYesThe unique identifier of the job you want to retrieve. Example: 'job-12345'.
org_idNoThe organization ID. Example: 'aiconnect'.

Implementation Reference

  • Executes the 'get_job' tool: destructures job_id and optional org_id, builds API endpoint, fetches job data via agentJobsClient.get, formats details, returns formatted text content or error message.
    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}` } ] }; }
  • Input schema for 'get_job' tool using Zod: requires job_id (string), optional org_id (string). Includes description and annotations.
    { 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() } },
  • Registers the 'get_job' MCP tool on the server with schema and handler function.
    export default (server: McpServer) => { 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}` } ] }; } } );

Other Tools

Related Tools

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/aiconnect-cloud/agentjobs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server