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
| Name | Required | Description | Default |
|---|---|---|---|
| cid | Yes | Root Content CID (e.g., bafy...) to remove from the uploads listing. | |
| removeShards | No | Also remove underlying shards from the store (default: false). Use with caution. |
Implementation Reference
- src/tool_handlers.ts:141-160 (handler)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(), }), }, ], }; };
- src/schemas.ts:54-67 (schema)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." ), });
- src/tool_handlers.ts:951-951 (registration)Registration of the w3_rm tool handler in the toolHandlers map used by the MCP server.w3_rm: handleW3Rm,