Skip to main content
Glama

listPaymentInstructionCids

Retrieve Content Identifiers (CIDs) linked to a specific payment instruction ID in the Pinata MCP server for IPFS content management.

Instructions

List CIDs associated with a payment instruction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe payment instruction ID
limitNoLimit the number of results returned
pageTokenNoToken for pagination

Implementation Reference

  • Complete implementation of the listPaymentInstructionCids tool - registers the tool with MCP server and contains the handler function that makes a GET request to Pinata API to list CIDs associated with a payment instruction
    server.tool(
      "listPaymentInstructionCids",
      "List CIDs associated with a payment instruction",
      {
        id: z.string().describe("The payment instruction ID"),
        limit: z
          .number()
          .optional()
          .describe("Limit the number of results returned"),
        pageToken: z.string().optional().describe("Token for pagination"),
      },
      async ({ id, limit, pageToken }) => {
        try {
          const params = new URLSearchParams();
          if (limit) params.append("limit", limit.toString());
          if (pageToken) params.append("pageToken", pageToken);
    
          const url = `https://api.pinata.cloud/v3/x402/payment_instructions/${id}/cids?${params.toString()}`;
    
          const response = await fetch(url, {
            method: "GET",
            headers: getHeaders(),
          });
    
          if (!response.ok) {
            throw new Error(
              `Failed to list CIDs: ${response.status} ${response.statusText}`
            );
          }
    
          const data = await response.json();
          return successResponse(data);
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • Input parameter schema definition for listPaymentInstructionCids - defines id (required), limit (optional), and pageToken (optional) parameters using Zod validation
    {
      id: z.string().describe("The payment instruction ID"),
      limit: z
        .number()
        .optional()
        .describe("Limit the number of results returned"),
      pageToken: z.string().optional().describe("Token for pagination"),
  • Helper function getHeaders() used by the tool to construct authorization headers with the Pinata JWT token
    const getHeaders = () => {
      if (!PINATA_JWT) {
        throw new Error("PINATA_JWT environment variable is not set");
      }
      return {
        Authorization: `Bearer ${PINATA_JWT}`,
        "Content-Type": "application/json",
      };
    };

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/PinataCloud/pinata-mcp'

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