Skip to main content
Glama

getGroup

Retrieve detailed information about a specific group by its ID from Pinata's IPFS network, enabling content organization and access management.

Instructions

Retrieve detailed information about a specific group by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoWhether the group is in public or private IPFSpublic
idYesThe unique ID of the group to retrieve

Implementation Reference

  • getGroup tool registration and handler - retrieves detailed information about a specific group by its ID from the Pinata API
    server.tool(
      "getGroup",
      "Retrieve detailed information about a specific group by its ID",
      {
        network: z
          .enum(["public", "private"])
          .default("public")
          .describe("Whether the group is in public or private IPFS"),
        id: z.string().describe("The unique ID of the group to retrieve"),
      },
      async ({ network, id }) => {
        try {
          const url = `https://api.pinata.cloud/v3/groups/${network}/${id}`;
    
          const response = await fetch(url, {
            method: "GET",
            headers: getHeaders(),
          });
    
          if (!response.ok) {
            throw new Error(
              `Failed to get group: ${response.status} ${response.statusText}`
            );
          }
    
          const data = await response.json();
          return successResponse(data);
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • getHeaders helper function - generates authorization headers with the PINATA_JWT token for API requests
    const getHeaders = () => {
      if (!PINATA_JWT) {
        throw new Error("PINATA_JWT environment variable is not set");
      }
      return {
        Authorization: `Bearer ${PINATA_JWT}`,
        "Content-Type": "application/json",
      };
    };
  • errorResponse helper function - returns a standardized error response format for tool failures
    const errorResponse = (error: unknown) => ({
      content: [
        {
          type: "text" as const,
          text: `Error: ${error instanceof Error ? error.message : String(error)}`,
        },
      ],
      isError: true,
    });
  • successResponse helper function - returns a standardized success response with JSON-formatted data
    const successResponse = (data: unknown) => ({
      content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
    });

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