w3_can_upload_add
Manually register an upload DAG by its root CID and shard CIDs for advanced use, typically after manually storing CAR shards on the MCP IPFS server.
Instructions
Manually registers an upload DAG by its root CID and shard CIDs (advanced use). This is typically used after storing CAR shards manually.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rootCid | Yes | Root data CID of the DAG to register. | |
| shardCids | Yes | One or more shard CIDs where the DAG data is stored. |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"description": "Manually registers an upload DAG by its root CID and shard CIDs (advanced use). This is typically used after storing CAR shards manually.",
"properties": {
"rootCid": {
"description": "Root data CID of the DAG to register.",
"type": "string"
},
"shardCids": {
"description": "One or more shard CIDs where the DAG data is stored.",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
}
},
"required": [
"rootCid",
"shardCids"
],
"type": "object"
}
Implementation Reference
- src/tool_handlers.ts:597-617 (handler)The handler function that implements the core logic for the 'w3_can_upload_add' tool. It validates input using the schema, executes the 'w3 can upload add' command with rootCid and shardCids, and formats the response.const handleW3CanUploadAdd: ToolHandler = async (args) => { const parsed = Schemas.W3CanUploadAddArgsSchema.safeParse(args); if (!parsed.success) throw new Error( `Invalid arguments for w3_can_upload_add: ${parsed.error.message}` ); const { rootCid, shardCids } = parsed.data; const shards = shardCids.join(" "); const { stdout } = await runW3Command(`can upload add ${rootCid} ${shards}`); return { content: [ { type: "text", text: JSON.stringify({ message: `Upload with root ${rootCid} registered successfully.`, output: stdout.trim(), }), }, ], }; };
- src/schemas.ts:231-241 (schema)Zod schema defining the input arguments for the w3_can_upload_add tool: rootCid (string) and shardCids (array of strings, min 1). Includes descriptions.export const W3CanUploadAddArgsSchema = z .object({ rootCid: z.string().describe("Root data CID of the DAG to register."), shardCids: z .array(z.string()) .min(1) .describe("One or more shard CIDs where the DAG data is stored."), }) .describe( "Manually registers an upload DAG by its root CID and shard CIDs (advanced use). This is typically used after storing CAR shards manually." );
- src/tool_handlers.ts:944-980 (registration)The toolHandlers object registers 'w3_can_upload_add' mapped to its handleW3CanUploadAdd function, making it available for the MCP server.export const toolHandlers: Record<string, ToolHandler> = { w3_login: handleW3Login, w3_space_ls: handleW3SpaceLs, w3_space_use: handleW3SpaceUse, w3_space_create: handleW3SpaceCreate, w3_up: handleW3Up, w3_ls: handleW3Ls, w3_rm: handleW3Rm, w3_open: handleW3Open, w3_space_info: handleW3SpaceInfo, w3_space_add: handleW3SpaceAdd, w3_delegation_create: handleW3DelegationCreate, w3_delegation_ls: handleW3DelegationLs, w3_delegation_revoke: handleW3DelegationRevoke, w3_proof_add: handleW3ProofAdd, w3_proof_ls: handleW3ProofLs, w3_key_create: handleW3KeyCreate, w3_bridge_generate_tokens: handleW3BridgeGenerateTokens, w3_can_blob_add: handleW3CanBlobAdd, w3_can_blob_ls: handleW3CanBlobLs, w3_can_blob_rm: handleW3CanBlobRm, w3_can_index_add: handleW3CanIndexAdd, w3_can_upload_add: handleW3CanUploadAdd, w3_can_upload_ls: handleW3CanUploadLs, w3_can_upload_rm: handleW3CanUploadRm, w3_plan_get: handleW3PlanGet, w3_account_ls: handleW3AccountLs, w3_space_provision: handleW3SpaceProvision, w3_coupon_create: handleW3CouponCreate, w3_usage_report: handleW3UsageReport, w3_can_access_claim: handleW3CanAccessClaim, w3_can_store_add: handleW3CanStoreAdd, w3_can_store_ls: handleW3CanStoreLs, w3_can_store_rm: handleW3CanStoreRm, w3_can_filecoin_info: handleW3CanFilecoinInfo, w3_reset: handleW3Reset, };