queryPinRequests
Check the status of IPFS content pinning requests by CID, filter by status, sort results, and manage pagination for tracking file storage on the Pinata network.
Instructions
Query the status of pin by CID requests
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| order | No | Sort by date_queued | |
| status | No | Filter by status | |
| cid | No | Filter by CID | |
| limit | No | Limit number of results | |
| pageToken | No | Token for pagination |
Implementation Reference
- src/index.ts:1616-1670 (registration)Registration and handler implementation for queryPinRequests tool that queries the status of pin by CID requests. The tool accepts parameters for filtering by order (ASC/DESC), status, cid, limit, and pageToken, and makes a GET request to Pinata's API to retrieve pin request status information.
server.tool( "queryPinRequests", "Query the status of pin by CID requests", { order: z .enum(["ASC", "DESC"]) .optional() .describe("Sort by date_queued"), status: z .enum([ "prechecking", "backfilled", "retreiving", "expired", "searching", "over_free_limit", "over_max_size", "invalid_object", "bad_host_node", ]) .optional() .describe("Filter by status"), cid: z.string().optional().describe("Filter by CID"), limit: z.number().optional().describe("Limit number of results"), pageToken: z.string().optional().describe("Token for pagination"), }, async ({ order, status, cid, limit, pageToken }) => { try { const params = new URLSearchParams(); if (order) params.append("order", order); if (status) params.append("status", status); if (cid) params.append("cid", cid); if (limit) params.append("limit", limit.toString()); if (pageToken) params.append("pageToken", pageToken); const url = `https://api.pinata.cloud/v3/files/public/pin_by_cid?${params.toString()}`; const response = await fetch(url, { method: "GET", headers: getHeaders(), }); if (!response.ok) { throw new Error( `Failed to query pin requests: ${response.status} ${response.statusText}` ); } const data = await response.json(); return successResponse(data); } catch (error) { return errorResponse(error); } } );