Skip to main content
Glama

addFileToGroup

Add an existing file to a Pinata group for organized IPFS content management using file and group IDs.

Instructions

Add an existing file to a group in your Pinata account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoWhether the group and file are in public or private IPFSpublic
groupIdYesThe ID of the group to add the file to
fileIdYesThe ID of the file to add to the group

Implementation Reference

  • src/index.ts:874-913 (registration)
    Tool registration for 'addFileToGroup' with schema definition (network, groupId, fileId) and handler implementation that makes a PUT request to Pinata API to add an existing file to a group
    server.tool(
      "addFileToGroup",
      "Add an existing file to a group in your Pinata account",
      {
        network: z
          .enum(["public", "private"])
          .default("public")
          .describe("Whether the group and file are in public or private IPFS"),
        groupId: z.string().describe("The ID of the group to add the file to"),
        fileId: z.string().describe("The ID of the file to add to the group"),
      },
      async ({ network, groupId, fileId }) => {
        try {
          const url = `https://api.pinata.cloud/v3/groups/${network}/${groupId}/ids/${fileId}`;
    
          const response = await fetch(url, {
            method: "PUT",
            headers: getHeaders(),
          });
    
          if (!response.ok) {
            throw new Error(
              `Failed to add file to group: ${response.status} ${response.statusText}`
            );
          }
    
          const data = await response.json();
          return {
            content: [
              {
                type: "text",
                text: `✅ File added to group successfully\n\n${JSON.stringify(data, null, 2)}`,
              },
            ],
          };
        } catch (error) {
          return errorResponse(error);
        }
      }
    );

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