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
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | Whether the group and file are in public or private IPFS | public |
| groupId | Yes | The ID of the group to add the file to | |
| fileId | Yes | The 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); } } );