Skip to main content
Glama

pinByCid

Pin existing IPFS content to your Pinata account by providing its CID, enabling centralized management and persistence of decentralized files.

Instructions

Pin an existing CID from the IPFS network to your Pinata account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesCID of the file you want to pin
nameNoCustom name for the file
group_idNoID of the group to add the file to
keyvaluesNoMetadata key-value pairs for the file
host_nodesNoArray of host node IDs to fetch from

Implementation Reference

  • src/index.ts:1555-1614 (registration)
    Tool registration and handler for pinByCid - pins existing CID from IPFS to Pinata account with optional metadata, group assignment, and host nodes specification
    server.tool(
      "pinByCid",
      "Pin an existing CID from the IPFS network to your Pinata account",
      {
        cid: z.string().describe("CID of the file you want to pin"),
        name: z.string().optional().describe("Custom name for the file"),
        group_id: z.string().optional().describe("ID of the group to add the file to"),
        keyvalues: z
          .record(z.string())
          .optional()
          .describe("Metadata key-value pairs for the file"),
        host_nodes: z
          .array(z.string())
          .optional()
          .describe("Array of host node IDs to fetch from"),
      },
      async ({ cid, name, group_id, keyvalues, host_nodes }) => {
        try {
          const url = "https://api.pinata.cloud/v3/files/public/pin_by_cid";
    
          const payload: {
            cid: string;
            name?: string;
            group_id?: string;
            keyvalues?: Record<string, string>;
            host_nodes?: string[];
          } = { cid };
    
          if (name) payload.name = name;
          if (group_id) payload.group_id = group_id;
          if (keyvalues) payload.keyvalues = keyvalues;
          if (host_nodes) payload.host_nodes = host_nodes;
    
          const response = await fetch(url, {
            method: "POST",
            headers: getHeaders(),
            body: JSON.stringify(payload),
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(
              `Failed to pin CID: ${response.status} ${response.statusText}\n${errorText}`
            );
          }
    
          const data = await response.json();
          return {
            content: [
              {
                type: "text",
                text: `✅ Pin request queued!\n\n${JSON.stringify(data, null, 2)}`,
              },
            ],
          };
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool pins an existing CID, implying a write/mutation operation, but doesn't disclose behavioral traits like required permissions, rate limits, whether the pin is permanent or reversible, or what happens on failure. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Pin an existing CID from the IPFS network to your Pinata account'). There's no wasted text, repetition, or unnecessary elaboration, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 5 parameters, no annotations, and no output schema, the description is minimally adequate. It states the purpose clearly but lacks behavioral context (e.g., mutation effects, error handling) and doesn't explain return values. For a mutation tool with this complexity, it should do more to compensate for the missing structured data, but it meets the bare minimum for understanding what the tool does.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 5 parameters (cid, name, group_id, keyvalues, host_nodes). The description doesn't add any parameter-specific semantics beyond what's in the schema, such as format examples or usage tips. With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Pin') and resource ('an existing CID from the IPFS network to your Pinata account'), distinguishing it from sibling tools like 'uploadFile' (which creates new content) and 'addFileToGroup' (which manages group membership). It specifies that the CID must already exist in the IPFS network, which is a key differentiator.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by stating 'Pin an existing CID from the IPFS network', suggesting it's for content already available on IPFS. However, it doesn't explicitly state when to use alternatives like 'uploadFile' (for new content) or 'addFileToGroup' (for grouping), nor does it mention prerequisites or exclusions, leaving some ambiguity for the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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