list_my_bounties
Retrieve your posted bounties with optional status filter, limit, and pagination.
Instructions
List bounties posted by the authenticated user. Filter by status. Requires TASKBOUNTY_API_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Optional comma-separated statuses, e.g. 'DRAFT,OPEN,AWARDED'. | |
| limit | No | Max items to return (default 25). | |
| offset | No | Offset for pagination (default 0). |
Implementation Reference
- src/index.ts:395-404 (handler)Handler for the 'list_my_bounties' tool: builds query params (status, limit, offset) and fetches GET /tasks/mine from the TaskBounty API with auth.
case "list_my_bounties": { const params = new URLSearchParams(); if (typeof a.status === "string") params.set("status", a.status); if (typeof a.limit === "number") params.set("limit", String(a.limit)); if (typeof a.offset === "number") params.set("offset", String(a.offset)); const qs = params.toString(); return await tbFetch(`/tasks/mine${qs ? `?${qs}` : ""}`, { requireAuth: true, }); } - src/index.ts:216-230 (schema)Schema and tool definition for 'list_my_bounties': accepts optional 'status' (comma-separated), 'limit' (number), and 'offset' (number).
name: "list_my_bounties", description: "List bounties posted by the authenticated user. Filter by status. Requires TASKBOUNTY_API_KEY.", inputSchema: { type: "object", properties: { status: { type: "string", description: "Optional comma-separated statuses, e.g. 'DRAFT,OPEN,AWARDED'.", }, limit: { type: "number", description: "Max items to return (default 25)." }, offset: { type: "number", description: "Offset for pagination (default 0)." }, }, }, }, - src/index.ts:275-277 (registration)Registration of all tools (including 'list_my_bounties') via ListToolsRequestSchema handler.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS as unknown as typeof TOOLS, })); - src/index.ts:23-77 (helper)tbFetch helper function used by the handler to make authenticated API calls to the TaskBounty API.
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 }] }; }