get_blob
Retrieve stored data by specifying a blob ID from the Walrus decentralized storage network, ensuring blockchain-verified access through the Sui network.
Instructions
Retrieve a blob from Walrus storage
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blobId | Yes | The blob ID to retrieve |
Implementation Reference
- src/index.ts:153-164 (handler)Handler for the 'get_blob' tool in the MCP call_tool request handler. Parses input arguments using GetBlobSchema, retrieves the blob via walrusClient.getBlob(blobId), and returns the base64-encoded blob content as text.case 'get_blob': { const { blobId } = GetBlobSchema.parse(args); const result = await walrusClient.getBlob(blobId); return { content: [ { type: 'text', text: result, }, ], }; }
- src/index.ts:35-37 (schema)Zod schema for validating input parameters of the get_blob tool: requires a blobId string.const GetBlobSchema = z.object({ blobId: z.string().describe('The blob ID to retrieve'), });
- src/index.ts:74-87 (registration)Registration of the 'get_blob' tool in the list_tools response, including name, description, and JSON input schema.{ name: 'get_blob', description: 'Retrieve a blob from Walrus storage', inputSchema: { type: 'object', properties: { blobId: { type: 'string', description: 'The blob ID to retrieve', }, }, required: ['blobId'], }, },
- src/walrus-client.ts:106-126 (helper)WalrusClient helper method that fetches the blob from the aggregator URL and returns it as a base64-encoded string. Called by the MCP tool handler.async getBlob(blobId: string): Promise<string> { try { const response = await this.httpClient.get( `${this.config.aggregatorUrl}/v1/${blobId}`, { responseType: 'arraybuffer', } ); // Return as base64 encoded string return Buffer.from(response.data).toString('base64'); } catch (error) { if (axios.isAxiosError(error)) { if (error.response?.status === 404) { throw new Error(`Blob not found: ${blobId}`); } throw new Error(`Failed to retrieve blob: ${error.response?.data?.error || error.message}`); } throw new Error(`Failed to retrieve blob: ${error instanceof Error ? error.message : String(error)}`); } }