coderswap_get_job_status
Check the status of a research ingestion job by providing the job ID to monitor progress and completion.
Instructions
Check the status of a research ingestion job
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"job_id": {
"minLength": 1,
"type": "string"
}
},
"required": [
"job_id"
],
"type": "object"
}
Implementation Reference
- src/index.ts:428-483 (registration)Registration of the 'coderswap_get_job_status' tool, including input/output schemas and the handler function.server.registerTool( 'coderswap_get_job_status', { title: 'Get CoderSwap Job Status', description: 'Check the status of a research ingestion job', inputSchema: { job_id: z.string().min(1, 'job_id is required') }, outputSchema: { job_id: z.string(), state: z.string(), crawled_count: z.number().optional(), failed_count: z.number().optional() } }, async ({ job_id }) => { try { log('debug', 'Checking job status', { job_id }) const job = await client.getJobStatus(job_id) const output = { job_id: job.job_id, state: job.state, crawled_count: job.crawled_count, failed_count: job.failed_count } log('info', `Job ${job_id} status: ${job.state}`) let statusText = `Job: ${job_id}\nStatus: ${job.state}` if (job.crawled_count !== undefined) { statusText += `\nCrawled: ${job.crawled_count} documents` } if (job.failed_count !== undefined && job.failed_count > 0) { statusText += `\nFailed: ${job.failed_count} documents` } return { content: [{ type: 'text', text: statusText }], structuredContent: output } } catch (error) { log('error', 'Failed to get job status', { job_id, error: error instanceof Error ? error.message : error }) return { content: [{ type: 'text', text: `✗ Failed to get job status: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true } } } )
- src/index.ts:443-482 (handler)The async handler function that executes the tool logic: fetches job status via client and formats response.async ({ job_id }) => { try { log('debug', 'Checking job status', { job_id }) const job = await client.getJobStatus(job_id) const output = { job_id: job.job_id, state: job.state, crawled_count: job.crawled_count, failed_count: job.failed_count } log('info', `Job ${job_id} status: ${job.state}`) let statusText = `Job: ${job_id}\nStatus: ${job.state}` if (job.crawled_count !== undefined) { statusText += `\nCrawled: ${job.crawled_count} documents` } if (job.failed_count !== undefined && job.failed_count > 0) { statusText += `\nFailed: ${job.failed_count} documents` } return { content: [{ type: 'text', text: statusText }], structuredContent: output } } catch (error) { log('error', 'Failed to get job status', { job_id, error: error instanceof Error ? error.message : error }) return { content: [{ type: 'text', text: `✗ Failed to get job status: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true } } }
- src/coderswap-client.ts:125-131 (helper)CoderSwapClient.getJobStatus method that makes the API request to retrieve the job status from the backend.async getJobStatus(jobId: string): Promise<IngestJobStatus> { const res = await fetch(`${this.baseUrl}/research/jobs/${jobId}`, { headers: this.headers }) const data = await this.handleResponse<{ job: IngestJobStatus }>(res) return data.job }
- src/types.ts:24-26 (schema)Zod schema for job status input (job_id), defined in types.ts (matches inline schema).export const jobStatusSchema = z.object({ job_id: z.string().min(1) })