Skip to main content
Glama
akave-ai

Akave MCP Server

by akave-ai

get_object

Retrieve object content from an S3-compatible storage bucket by specifying the bucket name and object key, enabling access to stored files and data.

Instructions

Get object content from a bucket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYesBucket name
keyYesObject key

Implementation Reference

  • The handler function for the 'get_object' MCP tool. Retrieves object using S3Client.getObject, handles errors, formats content as text, with special trimming for markdown files.
    async ({ bucket, key }: GetObjectParams) => {
      const object = await this.s3Client.getObject(bucket, key);
      if (!object) {
        return {
          content: [
            {
              type: "text",
              text: "Object not found",
            },
          ],
          isError: true,
        };
      }
    
      // Ensure we're returning a proper string
      let content =
        typeof object === "string" ? object : JSON.stringify(object);
    
      // For markdown files, ensure proper formatting
      if (key.endsWith(".md")) {
        // Remove any potential BOM or special characters
        content = content.replace(/^\uFEFF/, "").trim();
      }
    
      return {
        content: [
          {
            type: "text",
            text: content,
          },
        ],
      };
    }
  • Zod input schema for the get_object tool defining required parameters bucket and key.
      bucket: z.string().describe("Bucket name"),
      key: z.string().describe("Object key"),
    },
  • src/server.ts:93-99 (registration)
    Registration of the 'get_object' tool on the MCP server, including name, description, and input schema.
    this.server.tool(
      "get_object",
      "Get object content from a bucket",
      {
        bucket: z.string().describe("Bucket name"),
        key: z.string().describe("Object key"),
      },
  • TypeScript type definition for GetObjectParams used to type the handler input.
    interface GetObjectParams {
      bucket: string;
      key: string;
    }
  • Core helper method in S3Client that executes the AWS GetObjectCommand, streams and converts body to UTF-8 text, cleans content for text files, prettifies JSON, handles errors.
    async getObject(bucket: string, key: string) {
      try {
        const command = new GetObjectCommand({
          Bucket: bucket,
          Key: key,
        });
        const response = await this.client.send(command);
        if (!response.Body) {
          return null;
        }
        // Convert the response body to string
        const bodyStream = response.Body as any;
        const chunks: Uint8Array[] = [];
        for await (const chunk of bodyStream) {
          chunks.push(chunk);
        }
        const buffer = Buffer.concat(chunks);
        const text = buffer.toString("utf-8");
    
        // Handle different file types
        const extension = key.split(".").pop()?.toLowerCase();
    
        // Text-based files that should be cleaned
        const textFileExtensions = [
          "md",
          "txt",
          "json",
          "yaml",
          "yml",
          "xml",
          "html",
          "css",
          "js",
          "ts",
          "py",
          "sh",
          "bash",
        ];
    
        if (textFileExtensions.includes(extension || "")) {
          // Clean the text content
          const cleanedText = text
            .replace(/^\uFEFF/, "") // Remove BOM
            .trim(); // Remove extra whitespace
    
          // Special handling for JSON files
          if (extension === "json") {
            try {
              // Validate and format JSON
              const parsed = JSON.parse(cleanedText);
              return JSON.stringify(parsed, null, 2);
            } catch {
              // If JSON parsing fails, return as is
              return cleanedText;
            }
          }
    
          return cleanedText;
        }
    
        // For binary or unknown file types, return as is
        return text;
      } catch (error) {
        console.error("Error getting object:", error);
        return null;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a read operation but doesn't disclose critical details like authentication requirements, rate limits, error conditions, or what 'content' entails (e.g., binary data, text). This leaves significant gaps for an agent to understand how the tool behaves.

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 with zero waste. It's front-loaded with the core purpose and uses straightforward language, making it easy to parse quickly without unnecessary elaboration.

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?

For a tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address what 'content' means in the return value (e.g., data format, size limits) or behavioral aspects like error handling. Given the complexity of object storage operations and lack of structured data, more context is needed for effective use.

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?

Schema description coverage is 100%, with clear parameter descriptions in the schema ('bucket name', 'object key'). The tool description adds no additional meaning beyond the schema, such as explaining key formats or bucket constraints. Baseline 3 is appropriate since the schema adequately documents parameters.

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

Purpose4/5

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

The description clearly states the action ('Get') and resource ('object content from a bucket'), making the purpose immediately understandable. However, it doesn't differentiate from similar siblings like 'fetch_headers' or 'get_signed_url', which might also retrieve object-related information.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't explain if this retrieves full content versus metadata (compared to 'fetch_headers') or when to use 'get_signed_url' for temporary access instead. The description lacks any context about prerequisites or exclusions.

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

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