Skip to main content
Glama

w3_can_blob_add

Stores a single file as a blob on the IPFS network using an MCP server. Requires an absolute file path to ensure accurate file upload and management.

Instructions

Stores a single file as a blob directly with the service. Requires ABSOLUTE paths for file arguments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesABSOLUTE path to the blob file to store.

Implementation Reference

  • The main execution logic for the w3_can_blob_add tool: parses input args using the schema, executes the 'w3 can blob add' CLI command, parses the multihash and CID from stdout, and returns structured JSON response.
    const handleW3CanBlobAdd: ToolHandler = async (args) => { const parsed = Schemas.W3CanBlobAddArgsSchema.safeParse(args); if (!parsed.success) throw new Error( `Invalid arguments for w3_can_blob_add: ${parsed.error.message}` ); const { path } = parsed.data; const { stdout } = await runW3Command(`can blob add "${path}"`); const match = stdout.match(/Stored\s+(\S+)\s+\((\S+)\)/); const multihash = match?.[1]; const cid = match?.[2]; if (!multihash || !cid) { logger.warn( `w3_can_blob_add: Could not parse multihash/CID from output: ${stdout}` ); return { content: [ { type: "text", text: JSON.stringify({ message: "Blob added, but output parsing failed.", output: stdout.trim(), }), }, ], }; } return { content: [ { type: "text", text: JSON.stringify({ message: "Blob added successfully.", multihash, cid, output: stdout.trim(), }), }, ], }; };
  • Zod schema defining the input arguments for the tool: requires an absolute path to the blob file.
    export const W3CanBlobAddArgsSchema = z .object({ path: z.string().describe("ABSOLUTE path to the blob file to store."), }) .describe("Stores a single file as a blob directly with the service.");
  • Maps the tool name 'w3_can_blob_add' to its handler function in the central toolHandlers registry, which is used by index.ts to dispatch calls.
    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, };

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