job_status
Check the status of async web data jobs like crawls using the job ID. Monitor progress and completion for data gathering tasks.
Instructions
Check the status of an async job (e.g. crawl). Costs 0 credits.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | Job ID returned by crawl or other async endpoints |
Implementation Reference
- src/index.ts:159-164 (handler)The handler for the 'job_status' tool. It takes a job_id parameter and fetches the job status via apiGet, returning the result as JSON content.
server.tool( "job_status", "Check the status of an async job (e.g. crawl). Costs 0 credits.", { job_id: z.string().describe("Job ID returned by crawl or other async endpoints") }, async ({ job_id }) => jsonResult(await apiGet(`/jobs/${job_id}`)) ); - src/index.ts:162-162 (schema)Input schema for 'job_status' tool using Zod: defines job_id as a required string parameter with a description.
{ job_id: z.string().describe("Job ID returned by crawl or other async endpoints") }, - src/index.ts:159-164 (registration)Registration of the 'job_status' tool with the MCP server, including name, description, schema, and handler function.
server.tool( "job_status", "Check the status of an async job (e.g. crawl). Costs 0 credits.", { job_id: z.string().describe("Job ID returned by crawl or other async endpoints") }, async ({ job_id }) => jsonResult(await apiGet(`/jobs/${job_id}`)) ); - src/index.ts:20-39 (helper)Helper function apiGet that performs HTTP GET requests to the SearchClaw API with timeout handling and error management.
async function apiGet(path: string, params?: Record<string, string>) { const url = new URL(`${API_BASE}${path}`); if (params) { for (const [key, value] of Object.entries(params)) { url.searchParams.set(key, value); } } const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 30000); try { const response = await fetch(url.toString(), { headers, signal: controller.signal }); if (!response.ok) { const text = await response.text(); throw new Error(`SearchClaw API error ${response.status}: ${text}`); } return response.json(); } finally { clearTimeout(timeout); } } - src/index.ts:61-63 (helper)Helper function jsonResult that formats API responses as MCP text content with JSON serialization.
function jsonResult(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }