Skip to main content
Glama
akave-ai

Akave MCP Server

by akave-ai

list_objects

Retrieve a list of objects stored in an S3-compatible bucket, with optional prefix filtering to narrow results.

Instructions

List objects in a bucket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYesBucket name
prefixNoOptional prefix to filter objects

Implementation Reference

  • Handler function for list_objects tool: calls s3Client.listObjects and formats response as JSON text.
    async ({ bucket, prefix }: ListObjectsParams) => {
      const objects = await this.s3Client.listObjects(bucket, prefix);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              objects.map((obj) => ({
                key: obj.Key,
                size: obj.Size,
                lastModified: obj.LastModified,
              }))
            ),
          },
        ],
      };
    }
  • Zod input schema defining parameters for list_objects tool.
    {
      bucket: z.string().describe("Bucket name"),
      prefix: z
        .string()
        .optional()
        .describe("Optional prefix to filter objects"),
    },
  • TypeScript interface for ListObjectsParams used in handler type annotation.
    interface ListObjectsParams {
      bucket: string;
      prefix?: string;
    }
  • src/server.ts:64-92 (registration)
    Registration of the list_objects tool on the MCP server.
    this.server.tool(
      "list_objects",
      "List objects in a bucket",
      {
        bucket: z.string().describe("Bucket name"),
        prefix: z
          .string()
          .optional()
          .describe("Optional prefix to filter objects"),
      },
      async ({ bucket, prefix }: ListObjectsParams) => {
        const objects = await this.s3Client.listObjects(bucket, prefix);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                objects.map((obj) => ({
                  key: obj.Key,
                  size: obj.Size,
                  lastModified: obj.LastModified,
                }))
              ),
            },
          ],
        };
      }
    );
  • S3Client helper method that performs the actual ListObjectsV2Command to AWS S3-compatible service.
    async listObjects(bucket: string, prefix?: string) {
      const command = new ListObjectsV2Command({
        Bucket: bucket,
        Prefix: prefix,
      });
      const response = await this.client.send(command);
      return response.Contents || [];
    }

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/akave-ai/akave-mcp'

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