Skip to main content
Glama

w3_usage_report

Generate storage usage reports for specified or current spaces, with options to format output as JSON. Accessible via MCP IPFS Server for managing storage and data operations.

Instructions

Displays a storage usage report for the current or specified space.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsonNoFormat output as JSON (default: true).
spaceDidNoOptional DID of the space to get usage for (defaults to current space).

Implementation Reference

  • The handler function that executes the w3_usage_report tool. Parses input arguments using the schema, constructs and runs the 'w3 usage report' CLI command with optional --space and --json flags, parses NDJSON output if applicable, and returns a formatted MCP response.
    const handleW3UsageReport: ToolHandler = async (args) => {
      const parsed = Schemas.W3UsageReportArgsSchema.safeParse(args);
      if (!parsed.success)
        throw new Error(
          `Invalid arguments for w3_usage_report: ${parsed.error.message}`
        );
      const { spaceDid, json } = parsed.data;
      let command = "usage report";
      if (spaceDid) command += ` --space ${spaceDid}`;
      if (json) command += " --json";
      const { stdout } = await runW3Command(command);
      if (json) {
        try {
          const report = parseNdJson(stdout);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  usageReport: report.length > 0 ? report[0] : {},
                }),
              },
            ],
          };
        } catch (e) {
          logger.warn("Failed to parse usage report JSON, returning raw.");
          return {
            content: [
              { type: "text", text: JSON.stringify({ output: stdout.trim() }) },
            ],
          };
        }
      } else {
        return {
          content: [
            { type: "text", text: JSON.stringify({ output: stdout.trim() }) },
          ],
        };
      }
    };
  • Zod schema for input validation of w3_usage_report tool arguments: optional spaceDid (DID starting with did:key:), optional json boolean (defaults to true). Includes tool description.
    export const W3UsageReportArgsSchema = z
      .object({
        spaceDid: z
          .string()
          .startsWith("did:key:")
          .optional()
          .describe(
            "Optional DID of the space to get usage for (defaults to current space)."
          ),
        json: z
          .boolean()
          .optional()
          .default(true)
          .describe("Format output as JSON (default: true)."),
      })
      .describe(
        "Displays a storage usage report for the current or specified space."
      );
  • Registers the handleW3UsageReport handler under the 'w3_usage_report' key in the toolHandlers map, which is imported and used in src/index.ts to dynamically dispatch tool calls based on the requested tool name.
    w3_usage_report: handleW3UsageReport,
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'displays' a report, which implies a read-only operation, but doesn't clarify if this requires specific permissions, how the report is formatted beyond the JSON parameter, whether it includes real-time data, or what happens on errors. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part of the sentence earns its place by specifying the action, resource, and scope, making it highly concise and well-structured for quick understanding.

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's moderate complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and scope but lacks details on behavioral traits, output format beyond the JSON parameter, or error handling. Without annotations or output schema, more context would be helpful for safe and effective use.

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

Parameters3/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 fully documents both parameters (spaceDid for optional space targeting, json for output format). The description adds no additional parameter semantics beyond what's in the schema, such as explaining what 'space' entails or default behaviors. Baseline 3 is appropriate when the schema does all the work.

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 ('Displays a storage usage report') and resource ('for the current or specified space'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from potential sibling tools like 'w3_space_info' or 'w3_ls' that might also provide space-related information, preventing a perfect score.

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 implies usage context by mentioning 'current or specified space,' suggesting it can be used for either the active space or a targeted one. However, it provides no explicit guidance on when to choose this tool over alternatives like 'w3_space_info' or 'w3_ls,' nor does it mention any prerequisites or exclusions, leaving usage decisions somewhat ambiguous.

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