Skip to main content
Glama
KonMam

s3-mcp

by KonMam

put_object

Upload files or data to an Amazon S3 bucket by specifying bucket name, object key, and content body.

Instructions

Puts an object into an S3 bucket.

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

Returns: str: JSON formatted S3 response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYes
keyYes
bodyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler for the 'put_object' MCP tool. Decorated with @mcp.tool() for registration. Defines input schema via type hints and docstring. Executes core logic and formats response as JSON.
    @mcp.tool()
    def put_object(
        bucket: str,
        key: str,
        body: str,
    ) -> str:
        """Puts an object into an S3 bucket.
    
        Args:
            bucket (str): The name of the bucket.
            key (str): The key (name) of the object.
            body (str): The content of the object.
    
        Returns:
            str: JSON formatted S3 response.
        """
        result = _put_object_logic(bucket=bucket, key=key, body=body)
        return format_response(result)
  • Internal helper function implementing the core S3 put_object logic using boto3 client, handling body encoding.
    def _put_object_logic(
        bucket: str,
        key: str,
        body: Union[str, bytes],
    ) -> Dict[str, Any]:
        """Core logic to put an object into an S3 bucket.
    
        Args:
            bucket (str): The S3 bucket name.
            key (str): The S3 object key.
            body (Union[str, bytes]): The content of the object.
    
        Returns:
            Dict[str, Any]: Raw boto3 response from put_object.
        """
        client = get_s3_client()
        params: Dict[str, Any] = {"Bucket": bucket, "Key": key}
    
        if isinstance(body, str):
            params["Body"] = body.encode("utf-8")
        else:
            params["Body"] = body  # Assuming bytes or file-like object
    
        return client.put_object(**params)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions the action ('Puts') and return format ('JSON formatted S3 response'), it lacks critical details: whether this requires specific permissions, what happens if the object already exists (overwrites?), any rate limits, error conditions, or authentication requirements. For a write operation to cloud storage, this is a significant gap.

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 efficiently structured with a clear purpose statement followed by well-organized Args and Returns sections. Every sentence earns its place by providing essential information without redundancy or fluff.

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 that this is a write operation with no annotations and 3 parameters, the description does an adequate job covering the basics: purpose, parameters, and return format. However, it lacks important context about behavioral traits (overwrite behavior, permissions, errors) and doesn't help differentiate from sibling tools. The presence of an output schema reduces the need to explain return values in detail.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description explicitly documents all three parameters (bucket, key, body) with clear semantic explanations beyond the schema's basic titles. Since schema description coverage is 0%, this documentation is essential and adds substantial value by explaining what each parameter represents (e.g., 'key' as 'the name of the object').

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 ('Puts an object') and resource ('into an S3 bucket'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'upload_file' or 'copy_object', which could create ambiguity about when to use this specific tool versus alternatives.

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 like 'upload_file' or 'copy_object'. It doesn't mention prerequisites, constraints, or typical use cases, leaving the agent to guess based on tool names 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