w3_can_index_add
Adds a Content Identifier (CID) for indexing advanced data structures on the MCP IPFS server, enabling efficient data management and retrieval within storacha.network ecosystems.
Instructions
Registers an index CID with the service (advanced use). Please refer to storacha.network documentation for details on indices.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cid | Yes | CID of the index to add. |
Implementation Reference
- src/tool_handlers.ts:576-595 (handler)The main handler function that parses input arguments using the schema, executes the 'can index add' w3 command with the provided CID, and returns a success message with the command output.const handleW3CanIndexAdd: ToolHandler = async (args) => { const parsed = Schemas.W3CanIndexAddArgsSchema.safeParse(args); if (!parsed.success) throw new Error( `Invalid arguments for w3_can_index_add: ${parsed.error.message}` ); const { cid } = parsed.data; const { stdout } = await runW3Command(`can index add ${cid}`); return { content: [ { type: "text", text: JSON.stringify({ message: `Index CID ${cid} added successfully.`, output: stdout.trim(), }), }, ], }; };
- src/schemas.ts:224-230 (schema)Zod schema defining the input arguments for the tool, requiring a 'cid' string parameter.export const W3CanIndexAddArgsSchema = z .object({ cid: z.string().describe("CID of the index to add."), }) .describe( "Registers an index CID with the service (advanced use). Please refer to storacha.network documentation for details on indices." );
- src/tool_handlers.ts:965-965 (registration)Maps the tool name 'w3_can_index_add' to its handler function in the toolHandlers export, which is used by index.ts for routing tool calls.w3_can_index_add: handleW3CanIndexAdd,