approve_completion
Approve submitted work to complete a job. Use this when reviewing human-submitted work to move jobs from SUBMITTED to COMPLETED status, enabling payment and review processes.
Instructions
Approve submitted work for a job. Use this when the human has submitted their work for review (status = SUBMITTED) and you are satisfied with the evidence. Moves the job to COMPLETED, after which you can pay and leave a review.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | The job ID | |
| agent_key | Yes | Your agent API key (hp_...) |
Implementation Reference
- src/tools.ts:1427-1456 (handler)The handler for 'approve_completion' tool. Makes a PATCH request to /api/jobs/{job_id}/approve-completion with the agent_key header. Returns a success message with job ID and status, or throws an error if the API call fails.
if (name === 'approve_completion') { const res = await fetch(`${API_BASE}/api/jobs/${args?.job_id}/approve-completion`, { method: 'PATCH', headers: { 'Content-Type': 'application/json', 'X-Agent-Key': args?.agent_key as string, }, }); if (!res.ok) { const error = await res.json() as ApiError; throw new Error(error.reason || error.error || `API error: ${res.status}`); } const result = await res.json() as { id: string; status: string; message: string }; return { content: [ { type: 'text', text: `**Work Approved!** **Job ID:** ${result.id} **Status:** ${result.status} The work has been approved. You can now pay the human using \`mark_job_paid\` and then leave a review with \`leave_review\`.`, }, ], }; } - src/tools.ts:459-476 (registration)Registration of the 'approve_completion' tool in the ListToolsRequestSchema handler. Defines the tool name, description (for approving submitted work when status is SUBMITTED), and inputSchema with required 'job_id' and 'agent_key' parameters.
name: 'approve_completion', description: 'Approve submitted work for a job. Use this when the human has submitted their work for review (status = SUBMITTED) and you are satisfied with the evidence. Moves the job to COMPLETED, after which you can pay and leave a review.', inputSchema: { type: 'object', properties: { job_id: { type: 'string', description: 'The job ID', }, agent_key: { type: 'string', description: 'Your agent API key (hp_...)', }, }, required: ['job_id', 'agent_key'], }, },