Skip to main content
Glama

create_job

Set up new Agent Jobs by specifying job type, target platform, and optional parameters. Schedule jobs for future execution or run immediately using structured inputs.

Instructions

Create a new Agent Job with the minimal set of fields.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_type_idYesID of the job type (e.g. "mood-monitor")
paramsNoFree‑form params passed to the agent
scheduled_atNoSchedule the job to run later
target_channelYesWhere the agent will communicate.

Implementation Reference

  • Executes the 'create_job' tool: handles params, calls agentJobsClient.post('/services/agent-jobs'), logs with mcpDebugger, returns success message with jobId or error.
    async (params) => { mcpDebugger.toolCall("create_job", params); // Fall back to default org if none supplied. params.target_channel.org_id ??= config.DEFAULT_ORG_ID; mcpDebugger.debug("Job creation payload", { job_type_id: params.job_type_id, target_channel: params.target_channel, scheduled_at: params.scheduled_at, paramsCount: params.params ? Object.keys(params.params).length : 0 }); try { const res = await withTiming( () => agentJobsClient.post('/services/agent-jobs', params), "create_job API call" ); const jobId = res.id ?? 'unknown'; mcpDebugger.debug("Job creation response", { jobId, fullResponse: res }); const result = { content: [ { type: 'text' as const, text: `✅ Job created (id: ${jobId}).` } ] }; mcpDebugger.toolResponse("create_job", { jobId }); return result; } catch (error: any) { mcpDebugger.toolError("create_job", error); return { content: [ { type: 'text' as const, text: `Error creating job: ${error.message}` } ] }; } }
  • Zod input schema defining parameters for create_job: job_type_id, target_channel (platform, code, org_id), optional params and scheduled_at.
    inputSchema: { // Required fields job_type_id: z .string() .describe('ID of the job type (e.g. "mood-monitor")'), target_channel: z .object({ platform: z .enum(['whatsapp', 'slack', 'web']) .describe('Destination platform.'), code: z .string() .describe('Channel identifier, phone number, or user ID.'), org_id: z .string() .optional() .describe('Org ID – defaults to config.DEFAULT_ORG_ID') }) .describe('Where the agent will communicate.'), params: z .record(z.any()) .optional() .describe('Free‑form params passed to the agent'), scheduled_at: flexibleDateTimeSchema .optional() .describe('Schedule the job to run later') }
  • Registers the 'create_job' tool on the MCP server with description, annotations, inputSchema, and handler function.
    server.registerTool( 'create_job', { description: 'Create a new Agent Job with the minimal set of fields.', annotations: { title: 'Create Agent Job' }, inputSchema: { // Required fields job_type_id: z .string() .describe('ID of the job type (e.g. "mood-monitor")'), target_channel: z .object({ platform: z .enum(['whatsapp', 'slack', 'web']) .describe('Destination platform.'), code: z .string() .describe('Channel identifier, phone number, or user ID.'), org_id: z .string() .optional() .describe('Org ID – defaults to config.DEFAULT_ORG_ID') }) .describe('Where the agent will communicate.'), params: z .record(z.any()) .optional() .describe('Free‑form params passed to the agent'), scheduled_at: flexibleDateTimeSchema .optional() .describe('Schedule the job to run later') } }, async (params) => { mcpDebugger.toolCall("create_job", params); // Fall back to default org if none supplied. params.target_channel.org_id ??= config.DEFAULT_ORG_ID; mcpDebugger.debug("Job creation payload", { job_type_id: params.job_type_id, target_channel: params.target_channel, scheduled_at: params.scheduled_at, paramsCount: params.params ? Object.keys(params.params).length : 0 }); try { const res = await withTiming( () => agentJobsClient.post('/services/agent-jobs', params), "create_job API call" ); const jobId = res.id ?? 'unknown'; mcpDebugger.debug("Job creation response", { jobId, fullResponse: res }); const result = { content: [ { type: 'text' as const, text: `✅ Job created (id: ${jobId}).` } ] }; mcpDebugger.toolResponse("create_job", { jobId }); return result; } catch (error: any) { mcpDebugger.toolError("create_job", error); return { content: [ { type: 'text' as const, text: `Error creating 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