Skip to main content
Glama
KonMam

s3-mcp

by KonMam

list_objects_v2

Retrieve and list objects stored in an S3 bucket, with options to filter by prefix, paginate results, and group keys using delimiters for organized data access.

Instructions

Lists objects in an S3 bucket.

Args: bucket (str): The name of the bucket. prefix (Optional[str]): Filter for keys starting with this prefix. max_keys (Optional[int]): Maximum number of keys to return. continuation_token (Optional[str]): Token for paginating results. delimiter (Optional[str]): Delimiter for grouping keys.

Returns: str: JSON formatted S3 response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYes
prefixNo
max_keysNo
continuation_tokenNo
delimiterNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'list_objects_v2' MCP tool, decorated with @mcp.tool(). It receives parameters, calls the core logic helper, and returns a formatted JSON response.
    @mcp.tool()
    def list_objects_v2(
        bucket: str,
        prefix: Optional[str] = None,
        max_keys: Optional[int] = None,
        continuation_token: Optional[str] = None,
        delimiter: Optional[str] = None,
    ) -> str:
        """Lists objects in an S3 bucket.
    
        Args:
            bucket (str): The name of the bucket.
            prefix (Optional[str]): Filter for keys starting with this prefix.
            max_keys (Optional[int]): Maximum number of keys to return.
            continuation_token (Optional[str]): Token for paginating results.
            delimiter (Optional[str]): Delimiter for grouping keys.
    
        Returns:
            str: JSON formatted S3 response.
        """
        result = _list_objects_v2_logic(
            bucket=bucket,
            prefix=prefix,
            max_keys=max_keys,
            continuation_token=continuation_token,
            delimiter=delimiter,
        )
        return format_response(result)
  • Helper function containing the core implementation logic for listing S3 objects using boto3's list_objects_v2 method, handling parameters and making the API call.
    def _list_objects_v2_logic(
        bucket: str,
        prefix: Optional[str] = None,
        max_keys: Optional[int] = None,
        continuation_token: Optional[str] = None,
        delimiter: Optional[str] = None,
    ) -> Dict[str, Any]:
        """Core logic to list objects in an S3 bucket.
    
        Args:
            bucket (str): The S3 bucket name.
            prefix (Optional[str]): Filter for keys starting with this prefix.
            max_keys (Optional[int]): Maximum number of keys to return.
            continuation_token (Optional[str]): Token for paginating results.
            delimiter (Optional[str]): Delimiter for grouping keys.
    
        Returns:
            Dict[str, Any]: Raw boto3 response from list_objects_v2.
        """
        client = get_s3_client()
        params: Dict[str, Any] = {"Bucket": bucket}
        if prefix:
            params["Prefix"] = prefix
        if max_keys:
            params["MaxKeys"] = max_keys
        if continuation_token:
            params["ContinuationToken"] = continuation_token
        if delimiter:
            params["Delimiter"] = delimiter
        return client.list_objects_v2(**params)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the return format ('JSON formatted S3 response') which is helpful, but doesn't describe pagination behavior, rate limits, permissions required, error conditions, or whether this is a read-only operation. For an S3 listing tool with 5 parameters, this leaves significant behavioral gaps.

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 perfectly structured and concise: a clear purpose statement followed by well-organized Args and Returns sections. Every sentence earns its place, with no redundant information. The formatting makes it easy to scan and understand.

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 complexity (5 parameters, S3 operations) and the presence of an output schema (implied by 'Returns: str: JSON formatted S3 response'), the description is moderately complete. It covers all parameters well but lacks behavioral context about pagination, permissions, and error handling. With no annotations and siblings that include destructive operations, more guidance would be helpful.

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?

With 0% schema description coverage, the description must compensate - and it does well by explaining all 5 parameters with clear semantics: bucket as the container, prefix for filtering, max_keys for limiting results, continuation_token for pagination, and delimiter for grouping. This adds substantial value beyond the bare schema. The only minor gap is not explaining format expectations for continuation_token.

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 'Lists' and resource 'objects in an S3 bucket', making the purpose immediately understandable. It distinguishes from siblings like list_buckets (which lists buckets rather than objects) and other object operations like get_object or delete_object. However, it doesn't explicitly contrast with all siblings, so it's not a perfect 5.

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. It doesn't mention when list_objects_v2 is preferred over list_buckets (for listing objects vs buckets) or when pagination via continuation_token should be used. There's no discussion of prerequisites, performance considerations, or typical use cases.

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