Skip to main content
Glama

cancel_bounty

Cancel a draft bounty that has not been funded. Use this tool to remove an unfunded draft from the marketplace.

Instructions

Cancels an unfunded draft. Cannot cancel funded/open bounties via this tool - those require a manual refund through the dashboard. Requires TASKBOUNTY_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe draft task id to cancel.

Implementation Reference

  • src/index.ts:256-267 (registration)
    Tool registration and input schema for cancel_bounty. Defines the tool name, description, and that it requires a task_id (draft task id).
    {
      name: "cancel_bounty",
      description:
        "Cancels an unfunded draft. Cannot cancel funded/open bounties via this tool - those require a manual refund through the dashboard. Requires TASKBOUNTY_API_KEY.",
      inputSchema: {
        type: "object",
        properties: {
          task_id: { type: "string", description: "The draft task id to cancel." },
        },
        required: ["task_id"],
      },
    },
  • Handler for cancel_bounty. Extracts task_id from arguments, validates it's present, then makes an authenticated POST request to /tasks/{taskId}/cancel to cancel the draft bounty.
    case "cancel_bounty": {
      const taskId = String(a.task_id ?? "");
      if (!taskId) {
        return {
          content: [{ type: "text", text: "task_id is required" }],
          isError: true,
        };
      }
      return await tbFetch(`/tasks/${encodeURIComponent(taskId)}/cancel`, {
        method: "POST",
        body: JSON.stringify({}),
        requireAuth: true,
      });
    }
  • Helper function tbFetch used to make all authenticated API calls to the TaskBounty API, including the cancel_bounty handler.
    async function tbFetch(
      path: string,
      init: RequestInit & { requireAuth?: boolean } = {},
    ): Promise<ToolResult> {
      const { requireAuth, headers, ...rest } = init;
      if (requireAuth && !API_KEY) {
        return {
          content: [
            {
              type: "text",
              text: "Missing TASKBOUNTY_API_KEY environment variable. Set it to your tb_live_* key from https://www.task-bounty.com/dashboard/api-keys.",
            },
          ],
          isError: true,
        };
      }
      const url = `${API_BASE}${path}`;
      const finalHeaders: Record<string, string> = {
        Accept: "application/json",
        ...(headers as Record<string, string> | undefined),
      };
      if (API_KEY) finalHeaders["Authorization"] = `Bearer ${API_KEY}`;
      if (rest.body && !finalHeaders["Content-Type"]) {
        finalHeaders["Content-Type"] = "application/json";
      }
    
      let res: Response;
      try {
        res = await fetch(url, { ...rest, headers: finalHeaders });
      } catch (err) {
        return {
          content: [
            {
              type: "text",
              text: `Network error calling ${url}: ${err instanceof Error ? err.message : String(err)}`,
            },
          ],
          isError: true,
        };
      }
    
      const text = await res.text();
      if (!res.ok) {
        return {
          content: [
            {
              type: "text",
              text: `HTTP ${res.status} ${res.statusText} from ${url}\n\n${text}`,
            },
          ],
          isError: true,
        };
      }
      return { content: [{ type: "text", text }] };
    }
Behavior4/5

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

With no annotations, the description carries full burden. It discloses that it cancels only drafts, not funded bounties, and requires an API key. Lacks details on side effects or idempotency, but sufficient for a simple cancellation.

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?

Two sentences, no wasted words. Front-loaded purpose, efficient.

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

Completeness4/5

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

Given one parameter and no output schema, the description covers tool behavior, constraints, and prerequisites. Could mention return value, but not critical.

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?

Schema coverage is 100%, so baseline is 3. The description adds context: 'draft' and 'unfunded', beyond the schema's 'draft task id'. This adds value.

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 tool cancels an unfunded draft, with a specific verb and resource. It also explicitly differentiates from funded/open bounties, distinguishing it from sibling tools like fund_bounty.

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

Usage Guidelines5/5

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

Explicitly states when to use (unfunded drafts) and when not to use (funded/open bounties), providing an alternative (manual refund through dashboard). Also mentions the required API key.

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/eliottreich/taskbounty-mcp-server'

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