get_job_type
Retrieve agent job type details using its unique identifier, enabling efficient management and querying of asynchronous jobs within the AI Connect platform.
Instructions
Retrieves an agent job type by its ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_type_id | Yes | The unique identifier of the job type you want to retrieve. Example: 'mood-monitor'. | |
| org_id | No | The organization ID. Example: 'aiconnect'. |
Implementation Reference
- src/tools/get_job_type.ts:26-83 (handler)The core handler function for the 'get_job_type' tool. It extracts job_type_id and optional org_id from params, constructs an API endpoint, calls agentJobsClient.get to fetch the job type data, formats it using formatJobTypeDetails, and returns a text content response. Handles errors by returning an error message.async (params) => { mcpDebugger.toolCall("get_job_type", params); const { job_type_id } = params; const org_id = params.org_id || config.DEFAULT_ORG_ID; const endpoint = `/organizations/${org_id}/agent-jobs-type/${job_type_id}`; mcpDebugger.debug("Job type request", { endpoint, job_type_id, org_id, usingDefaultOrg: !params.org_id }); try { const response = await withTiming( () => agentJobsClient.get(endpoint), "get_job_type API call" ); mcpDebugger.debug("Job type raw response", { response }); // The API returns { data: {...}, meta: {...} } but agentJobsClient should extract data // However, let's be defensive and handle both cases const jobTypeData = response?.data ? response.data : response; mcpDebugger.debug("Job type extracted data", { jobTypeData }); const result = { content: [ { type: 'text' as const, text: formatJobTypeDetails(jobTypeData) } ] }; mcpDebugger.toolResponse("get_job_type", { job_type_id, org_id, resultLength: result.content[0].text.length, hasData: !!jobTypeData }); return result; } catch (error: any) { mcpDebugger.toolError("get_job_type", error); return { content: [ { type: 'text' as const, text: `Error getting job type: ${error.message}` } ] }; } }
- src/tools/get_job_type.ts:16-24 (schema)The input schema for the 'get_job_type' tool, validated using Zod. Requires job_type_id (string) and optional org_id (string). Provides descriptions and examples.inputSchema: { job_type_id: z.string({ description: "The unique identifier of the job type you want to retrieve. Example: 'mood-monitor'." }), org_id: z.string({ description: "The organization ID. Example: 'aiconnect'." }).optional() }
- src/tools/get_job_type.ts:9-84 (registration)The registration of the 'get_job_type' tool on the MCP server, including name, description, annotations, inputSchema, and the handler function.server.registerTool( 'get_job_type', { description: 'Retrieves an agent job type by its ID.', annotations: { title: 'Get Job Type Configuration' }, inputSchema: { job_type_id: z.string({ description: "The unique identifier of the job type you want to retrieve. Example: 'mood-monitor'." }), org_id: z.string({ description: "The organization ID. Example: 'aiconnect'." }).optional() } }, async (params) => { mcpDebugger.toolCall("get_job_type", params); const { job_type_id } = params; const org_id = params.org_id || config.DEFAULT_ORG_ID; const endpoint = `/organizations/${org_id}/agent-jobs-type/${job_type_id}`; mcpDebugger.debug("Job type request", { endpoint, job_type_id, org_id, usingDefaultOrg: !params.org_id }); try { const response = await withTiming( () => agentJobsClient.get(endpoint), "get_job_type API call" ); mcpDebugger.debug("Job type raw response", { response }); // The API returns { data: {...}, meta: {...} } but agentJobsClient should extract data // However, let's be defensive and handle both cases const jobTypeData = response?.data ? response.data : response; mcpDebugger.debug("Job type extracted data", { jobTypeData }); const result = { content: [ { type: 'text' as const, text: formatJobTypeDetails(jobTypeData) } ] }; mcpDebugger.toolResponse("get_job_type", { job_type_id, org_id, resultLength: result.content[0].text.length, hasData: !!jobTypeData }); return result; } catch (error: any) { mcpDebugger.toolError("get_job_type", error); return { content: [ { type: 'text' as const, text: `Error getting job type: ${error.message}` } ] }; } } );