w3_space_add
Add, manage, and verify storage spaces on the IPFS network by providing UCAN proof or base64 identity CID strings via the MCP server.
Instructions
Tool for w3_space_add operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| proof | Yes | Filesystem path to a CAR encoded UCAN proof, or a base64 identity CID string. |
Implementation Reference
- src/tool_handlers.ts:231-250 (handler)The handler function that implements the core logic for the 'w3_space_add' tool. It validates input arguments using the schema, executes the 'w3 space add' command with the provided proof, and returns the stdout output wrapped in a standardized MCP response.const handleW3SpaceAdd: ToolHandler = async (args) => { const parsed = Schemas.W3SpaceAddArgsSchema.safeParse(args); if (!parsed.success) throw new Error( `Invalid arguments for w3_space_add: ${parsed.error.message}` ); const { proof } = parsed.data; const { stdout } = await runW3Command(`space add "${proof}"`); return { content: [ { type: "text", text: JSON.stringify({ message: "Space added successfully from proof.", output: stdout.trim(), }), }, ], }; };
- src/schemas.ts:89-95 (schema)Zod schema defining the input arguments for the 'w3_space_add' tool, specifically requiring a 'proof' string which is a path to a CAR-encoded UCAN proof or a base64 identity CID.export const W3SpaceAddArgsSchema = z.object({ proof: z .string() .describe( "Filesystem path to a CAR encoded UCAN proof, or a base64 identity CID string." ), });
- src/tool_handlers.ts:954-954 (registration)Registration of the 'w3_space_add' handler in the toolHandlers map, which is used by the MCP server in index.ts to route CallTool requests to the appropriate handler.w3_space_add: handleW3SpaceAdd,