Skip to main content
Glama

s3_list_objects

List and filter objects within an S3-compatible storage bucket to manage files and directories.

Instructions

List objects in an S3 bucket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYesThe name of the bucket
prefixNoOptional prefix to filter objects
maxKeysNoMaximum number of keys to return (default 1000)

Implementation Reference

  • Handler implementation for the s3_list_objects tool. Extracts bucket, optional prefix and maxKeys from arguments, sends ListObjectsV2Command to S3 client, maps response Contents to simplified file objects (key, size, lastModified), and returns as JSON text content.
    case "s3_list_objects": { const { bucket, prefix, maxKeys } = request.params.arguments as { bucket: string; prefix?: string; maxKeys?: number; }; const command = new ListObjectsV2Command({ Bucket: bucket, Prefix: prefix, MaxKeys: maxKeys, }); const response = await s3Client.send(command); const files = (response.Contents || []).map((item) => ({ key: item.Key, size: item.Size, lastModified: item.LastModified, })); return { content: [ { type: "text", text: JSON.stringify(files, null, 2), }, ], }; }
  • Input schema definition for s3_list_objects tool, specifying required bucket and optional prefix/maxKeys.
    inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, prefix: { type: "string", description: "Optional prefix to filter objects", }, maxKeys: { type: "number", description: "Maximum number of keys to return (default 1000)", }, }, required: ["bucket"], },
  • src/index.ts:71-92 (registration)
    Registration of the s3_list_objects tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    { name: "s3_list_objects", description: "List objects in an S3 bucket", inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, prefix: { type: "string", description: "Optional prefix to filter objects", }, maxKeys: { type: "number", description: "Maximum number of keys to return (default 1000)", }, }, required: ["bucket"], }, },

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