jobs_get
Retrieve slide generation job status and results from 2slides.com by providing a job ID. Monitor progress until completion.
Instructions
Get job status/result by jobId from 2slides. Please check every 20 seconds until the status is success.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jobId | Yes |
Implementation Reference
- src/server.ts:59-77 (handler)The handler function for the 'jobs_get' MCP tool. It takes a jobId, makes a GET request to the 2slides API to retrieve job status/result, and returns the JSON response or error.mcp.tool('jobs_get', 'Get job status/result by jobId from 2slides. Please check every 20 seconds until the status is success.', JobArgs, async (args: any, _extra: any) => { const { jobId } = args as z.infer<z.ZodObject<typeof JobArgs>>; const url = `${API_BASE_URL}/api/v1/jobs/${encodeURIComponent(jobId)}`; const res = await fetch(url, { method: 'GET', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, }); const data = await res.json(); if (!res.ok) { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], isError: true, }; } return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; });
- src/server.ts:57-57 (schema)Zod schema for 'jobs_get' tool input parameters: requires a 'jobId' string.const JobArgs = { jobId: z.string().min(1) };
- src/server.ts:59-77 (registration)Registration of the 'jobs_get' tool using mcp.tool(), including schema reference and inline handler.mcp.tool('jobs_get', 'Get job status/result by jobId from 2slides. Please check every 20 seconds until the status is success.', JobArgs, async (args: any, _extra: any) => { const { jobId } = args as z.infer<z.ZodObject<typeof JobArgs>>; const url = `${API_BASE_URL}/api/v1/jobs/${encodeURIComponent(jobId)}`; const res = await fetch(url, { method: 'GET', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, }); const data = await res.json(); if (!res.ok) { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], isError: true, }; } return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; });