Skip to main content
Glama

w3_space_ls

List available storage spaces on the MCP IPFS server. Ensure you're logged in to view and manage your spaces effectively.

Instructions

Tool for w3_space_ls operation. NOTE: no current space and no space given or {"spaces":[]} first make sure you are logged in before using other tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'w3_space_ls' tool. It validates input arguments, runs the 'w3 space ls' command, parses the stdout to extract spaces (DID, name, isCurrent), and returns a JSON response with the list of spaces.
    const handleW3SpaceLs: ToolHandler = async (_args) => {
      const parsed = Schemas.W3SpaceLsArgsSchema.safeParse(_args);
      if (!parsed.success)
        throw new Error(
          `Invalid arguments for w3_space_ls: ${parsed.error.message}`
        );
    
      const { stdout } = await runW3Command("space ls");
      const spaces: {
        did: string;
        name: string | undefined;
        isCurrent: boolean;
      }[] = [];
      const lines = stdout.trim().split("\n");
    
      for (const line of lines) {
        let trimmedLine = line.trim();
        if (!trimmedLine) continue;
        let isCurrent = false;
        if (trimmedLine.startsWith("*")) {
          isCurrent = true;
          trimmedLine = trimmedLine.substring(1).trim();
        }
        const parts = trimmedLine.split(/\s+/);
        const did = parts[0];
        const name = parts.length > 1 ? parts.slice(1).join(" ") : undefined;
        if (did && did.startsWith("did:key:")) {
          spaces.push({ did, name, isCurrent });
        }
      }
      return {
        content: [{ type: "text", text: JSON.stringify({ spaces }) }],
      };
    };
  • Zod schema for 'w3_space_ls' tool arguments. Defines an empty object since no arguments are required.
    export const W3SpaceLsArgsSchema = z.object({});
  • Registers the 'w3_space_ls' handler in the toolHandlers map, which is used by the MCP server's CallToolRequestHandler to dispatch tool calls.
    w3_space_ls: handleW3SpaceLs,
  • src/index.ts:42-91 (registration)
    The ListToolsRequestHandler dynamically generates tool metadata, including for 'w3_space_ls', by iterating over Schemas and converting Zod schemas to JSON schemas for MCP tool discovery.
    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 };
    });
Behavior2/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 mentions login requirements and possible empty results ('no current space and no space given' or '{"spaces":[]}'), which adds some behavioral context. However, it lacks details on what the tool returns, error conditions, or other operational traits.

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

Conciseness3/5

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

The description is two sentences but includes redundant phrasing ('Tool for w3_space_ls operation'). The note about login and empty results is useful but could be more efficiently integrated. It is not overly verbose but lacks optimal structure.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete. It hints at login requirements and possible empty outputs but does not explain what the tool returns (e.g., a list of spaces), error handling, or how it differs from sibling tools like 'w3_ls'. More context is needed for a tool in this environment.

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?

The tool has 0 parameters with 100% schema description coverage, so no parameter documentation is needed. The description does not add parameter information, but this is acceptable given the lack of parameters, aligning with the baseline score for 0 params.

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

Purpose2/5

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

The description states 'Tool for w3_space_ls operation', which is a tautology that merely restates the tool name. It does not specify what the tool actually does (e.g., list spaces, show space details). However, it adds a note about login requirements, which provides some context beyond the name.

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

Usage Guidelines3/5

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

The description includes a note about ensuring login before use, which provides implied usage guidance. However, it does not explicitly state when to use this tool versus alternatives like 'w3_ls' or 'w3_space_info', nor does it provide clear exclusions or prerequisites beyond login.

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