addSignature
Attach EIP-712 cryptographic signatures to CIDs for content verification and authentication on IPFS networks.
Instructions
Add an EIP-712 cryptographic signature to a CID for content verification
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | Whether the file is on public or private IPFS | public |
| cid | Yes | The CID to sign | |
| signature | Yes | The EIP-712 signature | |
| address | Yes | The wallet address that created the signature |
Implementation Reference
- src/index.ts:1353-1395 (handler)Complete implementation of the 'addSignature' tool. It registers and implements an MCP tool that adds an EIP-712 cryptographic signature to a CID for content verification on Pinata. The tool accepts parameters for network (public/private), cid, signature, and address, then makes a POST request to the Pinata API endpoint.
server.tool( "addSignature", "Add an EIP-712 cryptographic signature to a CID for content verification", { network: z .enum(["public", "private"]) .default("public") .describe("Whether the file is on public or private IPFS"), cid: z.string().describe("The CID to sign"), signature: z.string().describe("The EIP-712 signature"), address: z.string().describe("The wallet address that created the signature"), }, async ({ network, cid, signature, address }) => { try { const url = `https://api.pinata.cloud/v3/files/${network}/signature/${cid}`; const response = await fetch(url, { method: "POST", headers: getHeaders(), body: JSON.stringify({ signature, address }), }); if (!response.ok) { const errorText = await response.text(); throw new Error( `Failed to add signature: ${response.status} ${response.statusText}\n${errorText}` ); } const data = await response.json(); return { content: [ { type: "text", text: `✅ Signature added successfully!\n\n${JSON.stringify(data, null, 2)}`, }, ], }; } catch (error) { return errorResponse(error); } } );