Skip to main content
Glama

w3_can_store_add

Stores a CAR file with the IPFS service using absolute paths, enabling advanced data management. Essential for preparing files before upload operations with w3_can_upload_add.

Instructions

Stores a CAR file with the service (advanced use). This is often a prerequisite for w3_can_upload_add. Requires ABSOLUTE paths for file arguments.

Input Schema

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

Implementation Reference

  • The main handler function for the w3_can_store_add tool. It validates input arguments using the schema, executes the underlying `w3 can store add` command with the provided absolute path to a CAR file, and formats the stdout output as MCP response content.
    const handleW3CanStoreAdd: ToolHandler = async (args) => {
      const parsed = Schemas.W3CanStoreAddArgsSchema.safeParse(args);
      if (!parsed.success)
        throw new Error(
          `Invalid arguments for w3_can_store_add: ${parsed.error.message}`
        );
      const { path } = parsed.data;
      const { stdout } = await runW3Command(`can store add "${path}"`);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              message: "CAR file stored successfully.",
              output: stdout.trim(),
            }),
          },
        ],
      };
    };
  • Zod schema defining the input parameters for the tool: requires an absolute path to the CAR file to store.
    export const W3CanStoreAddArgsSchema = z
      .object({
        path: z.string().describe("ABSOLUTE path to the CAR file to store."),
      })
      .describe(
        "Stores a CAR file with the service (advanced use). This is often a prerequisite for `w3_can_upload_add`."
      );
  • The toolHandlers map registers 'w3_can_store_add' to its handler function. This map is imported and used in index.ts to dispatch CallTool requests to the correct handler.
    // Tool Handlers Map
    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,
    };
  • src/index.ts:42-91 (registration)
    Dynamic tool registration in the MCP server's ListTools handler. Scans Schemas exports to generate tool metadata (name, inputSchema, description) for all tools including w3_can_store_add.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      const tools = Object.entries(Schemas)
        .filter(([name, schema]) => {
          return name.endsWith("ArgsSchema") && schema instanceof z.ZodType;
        })
        .map(([schemaName, schema]) => {
          const toolName = schemaName
            .replace(/([A-Z])/g, "_$1")
            .replace("_Args_Schema", "")
            .toLowerCase()
            .substring(1);
    
          let description =
            schema.description ?? `Tool for ${toolName} operation.`;
    
          // Special description overrides for enhanced clarity
          if (toolName === "w3_login") {
            description =
              "Initiates the w3 login process using the pre-configured email (W3_LOGIN_EMAIL env var). IMPORTANT: The command expects email confirmation, so before running the `w3_login` tool, emphasize ATTENTION to the user in large letters + emoji that they MUST check email to complete authentication. If the final output includes 'Agent was authorized by', the user has already clicked the link and is successfully authorized, CONTINUE using mcp-ipfs tools. 'Too Many Requests': wait a moment before requesting it again.";
          }
          if (toolName === "w3_space_info" || toolName === "w3_space_ls") {
            description +=
              ' NOTE: `no current space and no space given` or `{"spaces":[]}` first make sure you are logged in before using other tools.';
          }
          if (toolName === "w3_space_create") {
            description +=
              " NOTE: `w3 space create` cannot be run via MCP due to interactive recovery key prompts. Please run this command manually in your terminal.";
          }
          if (
            [
              "w3_up",
              "w3_delegation_create",
              "w3_delegation_revoke",
              "w3_proof_add",
              "w3_can_blob_add",
              "w3_can_store_add",
            ].includes(toolName)
          ) {
            description += " Requires ABSOLUTE paths for file arguments.";
          }
    
          return {
            name: toolName,
            description: description.trim(),
            inputSchema: zodToJsonSchema(schema) as ToolInputSchema,
          };
        });
    
      return { tools };
    });
  • src/index.ts:94-125 (registration)
    MCP CallTool request handler that dispatches to the specific tool handler via toolHandlers[name], enabling execution of w3_can_store_add.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      logger.info(`Handling CallTool request for: ${name}`);
    
      const handler = toolHandlers[name];
    
      if (!handler) {
        logger.error(`Unknown tool requested: ${name}`);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({ error: `Unknown tool: ${name}` }),
            },
          ],
          isError: true,
        };
      }
    
      try {
        const result = await handler(args);
        return result;
      } catch (error: any) {
        logger.error(`Error handling tool '${name}':`, error);
        return {
          content: [
            { type: "text", text: JSON.stringify({ error: error.message }) },
          ],
          isError: true,
        };
      }
    });
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It adds some behavioral context by specifying 'advanced use' and the prerequisite relationship with another tool, but it lacks details on permissions, side effects (e.g., whether it overwrites existing files), rate limits, or error handling. This leaves gaps in understanding the tool's behavior beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and front-loaded: it states the core purpose in the first sentence, adds usage context in the second, and includes a critical requirement in the third. Every sentence earns its place with no wasted words, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 1 parameter with full schema coverage and no output schema, the description provides adequate basics like purpose and usage context. However, as a mutation tool (implied by 'Stores') with no annotations, it lacks details on behavioral aspects such as permissions, idempotency, or return values, which would be needed for more complete understanding in complex scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the 'path' parameter. The description adds value by emphasizing 'ABSOLUTE paths for file arguments' in a separate sentence, reinforcing the requirement beyond the schema's description. This extra emphasis helps clarify usage, though it doesn't introduce new parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Stores a CAR file') and resource ('with the service'), making the purpose understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'w3_can_store_ls' or 'w3_can_store_rm', which would require more specific context about what 'store' means versus 'list' or 'remove'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool: it's for 'advanced use' and 'often a prerequisite for `w3_can_upload_add`'. This gives practical guidance on its role in workflows. However, it doesn't explicitly state when not to use it or mention alternatives among siblings, which could further clarify usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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