Skip to main content
Glama

w3_rm

Remove a specified Content Identifier (CID) and its associated shards from the uploads listing on the MCP IPFS server to manage storage efficiently.

Instructions

Tool for w3_rm operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidYesRoot Content CID (e.g., bafy...) to remove from the uploads listing.
removeShardsNoAlso remove underlying shards from the store (default: false). Use with caution.

Implementation Reference

  • Handler function that validates input using W3RmArgsSchema, constructs and executes the 'w3 rm' command, and returns the result as MCP content.
    const handleW3Rm: ToolHandler = async (args) => {
      const parsed = Schemas.W3RmArgsSchema.safeParse(args);
      if (!parsed.success)
        throw new Error(`Invalid arguments for w3_rm: ${parsed.error.message}`);
      const { cid, removeShards } = parsed.data;
      let command = `rm ${cid}`;
      if (removeShards) command += " --shards";
      const { stdout } = await runW3Command(command);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              message: `Successfully removed listing for CID ${cid}.`,
              output: stdout.trim(),
            }),
          },
        ],
      };
    };
  • Zod schema defining the input arguments for the w3_rm tool: required 'cid' string and optional 'removeShards' boolean.
    export const W3RmArgsSchema = z.object({
      cid: z
        .string()
        .describe(
          "Root Content CID (e.g., bafy...) to remove from the uploads listing."
        ),
      removeShards: z
        .boolean()
        .optional()
        .default(false)
        .describe(
          "Also remove underlying shards from the store (default: false). Use with caution."
        ),
    });
  • Registration of the w3_rm tool handler in the toolHandlers map used by the MCP server.
    w3_rm: handleW3Rm,

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/alexbakers/mcp-ipfs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server