Skip to main content
Glama

store_blob

Store data in decentralized storage using base64 encoding or file paths, with configurable retention periods through blockchain verification on the Sui network.

Instructions

Store a blob in Walrus decentralized storage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesBase64 encoded data or file path to store
epochsNoNumber of epochs to store the blob (default: 5)

Implementation Reference

  • MCP tool handler for 'store_blob': parses arguments using StoreBlobSchema and delegates to walrusClient.storeBlob, returning JSON stringified result
    case 'store_blob': {
      const { data, epochs = 5 } = StoreBlobSchema.parse(args);
      const result = await walrusClient.storeBlob(data, epochs);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Zod input schema for store_blob tool validation
    const StoreBlobSchema = z.object({
      data: z.string().describe('Base64 encoded data or file path to store'),
      epochs: z.number().optional().describe('Number of epochs to store the blob (default: 5)'),
    });
  • src/index.ts:56-72 (registration)
    Registration of store_blob tool in the listTools response, including name, description, and input schema
    name: 'store_blob',
    description: 'Store a blob in Walrus decentralized storage',
    inputSchema: {
      type: 'object',
      properties: {
        data: {
          type: 'string',
          description: 'Base64 encoded data or file path to store',
        },
        epochs: {
          type: 'number',
          description: 'Number of epochs to store the blob (default: 5)',
          default: 5,
        },
      },
      required: ['data'],
    },
  • Core storeBlob implementation in WalrusClient: handles file paths or base64 data, publishes to Walrus publisher endpoint, parses response into BlobInfo
    async storeBlob(data: string, epochs: number = 5): Promise<BlobInfo> {
      try {
        let blobData: Buffer;
        
        // Check if data is a file path or base64 encoded data
        if (data.startsWith('/') || data.startsWith('./') || data.startsWith('../')) {
          // It's a file path
          blobData = await fs.readFile(data);
        } else {
          // It's base64 encoded data
          blobData = Buffer.from(data, 'base64');
        }
    
        const response = await this.httpClient.put(
          `${this.config.publisherUrl}/v1/store`,
          blobData,
          {
            headers: {
              'Content-Type': 'application/octet-stream',
            },
            params: {
              epochs: epochs.toString(),
            },
          }
        );
    
        if (response.data.newlyCreated) {
          return {
            blobId: response.data.newlyCreated.blobObject.blobId,
            size: response.data.newlyCreated.blobObject.size,
            encodedSize: response.data.newlyCreated.blobObject.encodedSize,
            storageId: response.data.newlyCreated.blobObject.id,
            certified: response.data.newlyCreated.resourceObject ? true : false,
            certifiedEpoch: response.data.newlyCreated.resourceObject?.storage?.startEpoch,
            endEpoch: response.data.newlyCreated.resourceObject?.storage?.endEpoch,
          };
        } else if (response.data.alreadyCertified) {
          return {
            blobId: response.data.alreadyCertified.blobId,
            size: 0, // Size not provided for already certified blobs
            encodedSize: 0,
            storageId: response.data.alreadyCertified.blobId,
            certified: true,
            certifiedEpoch: response.data.alreadyCertified.certifiedEpoch,
            endEpoch: response.data.alreadyCertified.endEpoch,
          };
        }
    
        throw new Error('Unexpected response format from Walrus publisher');
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Failed to store blob: ${error.response?.data?.error || error.message}`);
        }
        throw new Error(`Failed to store blob: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
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 of behavioral disclosure. While 'Store' implies a write operation, it fails to describe critical behaviors like whether storage is permanent or reversible, authentication requirements, rate limits, or error conditions. This leaves significant gaps for a mutation tool.

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 directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to parse quickly.

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 the tool's complexity (a write operation with no annotations and no output schema), the description is incomplete. It lacks details on behavioral traits, error handling, or return values, which are essential for an agent to use this tool effectively in a decentralized storage context.

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?

The input schema has 100% description coverage, documenting both parameters (data as base64/file path, epochs with default). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 without compensating for any gaps.

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

Purpose5/5

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

The description clearly states the specific action ('Store') and resource ('a blob in Walrus decentralized storage'), making the purpose immediately understandable. It distinguishes this tool from its siblings (delete_blob, get_blob, etc.) by specifying it's for storage rather than retrieval or deletion.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like list_blobs or get_blob. It lacks context about prerequisites, such as whether data must be pre-processed or if there are storage limits, leaving the agent without usage direction.

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

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/Motion-Labs-Sui/walrus-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server