Skip to main content
Glama

s3_read_object

Retrieve content from an S3-compatible storage bucket by specifying the bucket name and object key path.

Instructions

Read the content of an object from an S3 bucket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYesThe name of the bucket
keyYesThe key (path) of the object

Implementation Reference

  • The handler for the s3_read_object tool. Extracts bucket and key from arguments, sends GetObjectCommand to S3 client, converts response body stream to string using streamToString helper, and returns the content as text.
    case "s3_read_object": { const { bucket, key } = request.params.arguments as { bucket: string; key: string; }; const command = new GetObjectCommand({ Bucket: bucket, Key: key, }); const response = await s3Client.send(command); const body = await streamToString(response.Body); return { content: [ { type: "text", text: body, }, ], }; }
  • Input schema definition for s3_read_object tool, specifying bucket and key as required string parameters.
    inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, key: { type: "string", description: "The key (path) of the object", }, }, required: ["bucket", "key"], },
  • src/index.ts:93-110 (registration)
    Registration of the s3_read_object tool in the listTools response, including name, description, and input schema.
    { name: "s3_read_object", description: "Read the content of an object from an S3 bucket", inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, key: { type: "string", description: "The key (path) of the object", }, }, required: ["bucket", "key"], }, },
  • Helper utility to convert S3 GetObject response stream to a string, specifically used in the s3_read_object handler.
    const streamToString = (stream: any): Promise<string> => new Promise((resolve, reject) => { const chunks: any[] = []; stream.on("data", (chunk: any) => chunks.push(chunk)); stream.on("error", reject); stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8"))); });

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/AM1010101/s3-mcp-server'

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