fund_job
Fund an open job by locking USDC budget into escrow, requiring two on-chain operations: USDC approval and job funding.
Instructions
Fund a Job created via create_job. Locks the budget USDC into escrow. Requires that the Job is in 'open' state. Two on-chain operations: USDC.approve(jobs) + Jobs.fund. Status: open → funded.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jobId | Yes | Job ID returned by create_job (job_...) |
Implementation Reference
- src/index.ts:264-280 (registration)Registration of the 'fund_job' tool via server.tool() with name 'fund_job', description, Zod schema for jobId, and async handler.
// Tool 8: Fund Job server.tool( "fund_job", "Fund a Job created via create_job. Locks the budget USDC into escrow. Requires that the Job is in 'open' state. Two on-chain operations: USDC.approve(jobs) + Jobs.fund. Status: open → funded.", { jobId: z.string().describe("Job ID returned by create_job (job_...)"), }, async ({ jobId }) => { try { const res = await callApi("POST", `/jobs/${jobId}/fund`); if (!res.ok) return errorResponse("Fund job failed", res); return successResponse(res.json); } catch (e) { return { content: [{ type: "text" as const, text: `Fund job error: ${e}` }], isError: true }; } }, ); - src/index.ts:271-279 (handler)Handler function for fund_job: takes {jobId}, calls POST /jobs/{jobId}/fund via callApi helper, returns success or error response.
async ({ jobId }) => { try { const res = await callApi("POST", `/jobs/${jobId}/fund`); if (!res.ok) return errorResponse("Fund job failed", res); return successResponse(res.json); } catch (e) { return { content: [{ type: "text" as const, text: `Fund job error: ${e}` }], isError: true }; } }, - src/index.ts:268-270 (schema)Input schema for fund_job: requires a single string parameter 'jobId' (Job ID returned by create_job, e.g. job_...).
{ jobId: z.string().describe("Job ID returned by create_job (job_...)"), }, - src/index.ts:228-228 (helper)Section comment marking 'Sprint 9: ERC-8183 Job (Escrow) tools' — fund_job is part of this group.
// ── Sprint 9: ERC-8183 Job (Escrow) tools ──────────────────────