Skip to main content
Glama
KonMam

s3-mcp

by KonMam

get_object

Retrieve objects from AWS S3 buckets by specifying bucket name and object key to access stored data.

Instructions

Gets an object from an S3 bucket.

Args: bucket (str): The name of the bucket. key (str): The key (name) of the object.

Returns: str: JSON formatted S3 response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYes
keyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_object' MCP tool. Registered via @mcp.tool() decorator. Calls the private helper logic and formats the response.
    @mcp.tool()
    def get_object(bucket: str, key: str) -> str:
        """Gets an object from an S3 bucket.
    
        Args:
            bucket (str): The name of the bucket.
            key (str): The key (name) of the object.
    
        Returns:
            str: JSON formatted S3 response.
        """
        result = _get_object_logic(bucket=bucket, key=key)
        return format_response(result)
  • Private helper implementing the core S3 get_object operation using boto3 client, reads and decodes the body for JSON serialization.
    def _get_object_logic(bucket: str, key: str) -> Dict[str, Any]:
        """Core logic to get an object from an S3 bucket.
    
        Args:
            bucket (str): The S3 bucket name.
            key (str): The S3 object key.
    
        Returns:
            Dict[str, Any]: Raw boto3 response from get_object.
        """
        client = get_s3_client()
        response = client.get_object(Bucket=bucket, Key=key)
        # The body is a StreamingBody, which is not directly JSON serializable.
        # We read it and decode it to a string.
        if 'Body' in response:
            response['Body'] = response['Body'].read().decode('utf-8')
        return response
  • src/s3_mcp.py:164-164 (registration)
    The @mcp.tool() decorator registers the get_object function as an MCP tool.
    @mcp.tool()
  • Utility function to format tool responses as indented JSON strings, used by get_object.
    def format_response(data: Any) -> str:
        """Format response data as JSON string.
    
        Args:
            data (Any): Data to format
    
        Returns:
            str: JSON formatted string
        """
        return json.dumps(data, indent=2, default=str)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Gets') and return format ('JSON formatted S3 response'), but doesn't mention critical details like authentication requirements, error handling, rate limits, or whether it retrieves metadata or full content. This is a significant gap for a tool interacting with external storage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and concise, with a clear purpose statement followed by Args and Returns sections. Each sentence serves a purpose, and there's no redundant information. It could be slightly more front-loaded by integrating the return format into the main sentence, but overall it's efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (external S3 interaction) and lack of annotations, the description is minimally adequate. It covers the basic action and parameters but misses important behavioral context. The presence of an output schema means the description doesn't need to detail return values, but it should still address usage and error scenarios more thoroughly.

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 0%, so the schema provides no parameter descriptions. The description adds basic semantics by explaining 'bucket' as 'The name of the bucket' and 'key' as 'The key (name) of the object', which clarifies what these parameters represent. However, it doesn't provide examples, constraints, or format details, leaving room for ambiguity.

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 verb ('Gets') and resource ('an object from an S3 bucket'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'head_object' or 'download_file', which might retrieve object metadata or download content differently.

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?

The description provides no guidance on when to use this tool versus alternatives such as 'head_object' for metadata or 'download_file' for file downloads. It lacks any context about prerequisites, error conditions, or typical use cases, leaving the agent to infer usage from the name alone.

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

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