Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
jobIdYesJob 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 };
        }
      },
    );
  • 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 };
      }
    },
  • 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_...)"),
    },
  • Section comment marking 'Sprint 9: ERC-8183 Job (Escrow) tools' — fund_job is part of this group.
    // ── Sprint 9: ERC-8183 Job (Escrow) tools ──────────────────────
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully discloses the tool's behavior: it performs two on-chain operations (USDC.approve and Jobs.fund), changes status from 'open' to 'funded', and requires the job to be open. This is transparent for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences with no wasted words. It front-loads purpose, then constraints, then operations. Every sentence serves a distinct purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no output schema, but involves on-chain actions), the description covers purpose, prerequisites, side effects, and resulting state. No gaps remain.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The single parameter jobId has a schema description clarifying it's the ID from create_job. The description adds value by specifying the origin of the ID, which helps the agent understand the required input beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Fund' and resource 'Job created via create_job', distinguishes it from sibling tools like create_job (which creates), and specifies the action of locking USDC into escrow.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly requires the Job to be in 'open' state and describes the two on-chain operations. However, it does not explicitly state when not to use or list alternatives, though the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mrocker/cardzero-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server