Skip to main content
Glama
jneless
by jneless

tos_list_objects

List objects in a TOS bucket with optional filtering by prefix, delimiter, and maximum results to manage storage content effectively.

Instructions

列举 TOS 对象

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYes存储桶名称
delimiterNo分隔符
max_keysNo最大返回对象数量
prefixNo对象键前缀

Implementation Reference

  • The main handler function that lists objects in a TOS bucket using tos_client.list_objects_type2, parses the response into a structured JSON format including objects, common prefixes, truncation status, and next token.
    async def list_objects(args: Dict[str, Any]) -> List[TextContent]:
        """列举对象"""
        bucket_name = args["bucket_name"]
        prefix = args.get("prefix", "")
        delimiter = args.get("delimiter", "")
        max_keys = args.get("max_keys", 1000)
        
        try:
            resp = tos_client.list_objects_type2(bucket_name, prefix=prefix, delimiter=delimiter, max_keys=max_keys)
            
            result = {
                "objects": [],
                "common_prefixes": [],
                "is_truncated": resp.is_truncated,
                "next_continuation_token": resp.next_continuation_token
            }
            
            for obj in resp.contents:
                result["objects"].append({
                    "key": obj.key,
                    "last_modified": str(obj.last_modified) if obj.last_modified else None,
                    "size": obj.size,
                    "etag": obj.etag,
                    "storage_class": str(obj.storage_class) if obj.storage_class else None
                })
                
            for prefix in resp.common_prefixes:
                result["common_prefixes"].append(prefix.prefix)
            
            return [TextContent(type="text", text=json.dumps(result, indent=2, ensure_ascii=False))]
        except Exception as e:
            return [TextContent(type="text", text=f"列举对象失败: {str(e)}")]
  • Defines the Tool schema for tos_list_objects, including input parameters like bucket_name (required), prefix, delimiter, max_keys with descriptions and defaults.
    Tool(
        name="tos_list_objects",
        description="列举 TOS 对象",
        inputSchema={
            "type": "object",
            "properties": {
                "bucket_name": {
                    "type": "string",
                    "description": "存储桶名称"
                },
                "prefix": {
                    "type": "string",
                    "description": "对象键前缀",
                    "default": ""
                },
                "delimiter": {
                    "type": "string",
                    "description": "分隔符",
                    "default": ""
                },
                "max_keys": {
                    "type": "integer",
                    "description": "最大返回对象数量",
                    "default": 1000
                }
            },
            "required": ["bucket_name"]
        }
    ),
  • Registers the tool dispatch in the call_tool handler by mapping the tool name to the list_objects function call.
    elif name == "tos_list_objects":
        return await list_objects(arguments)
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It only states the action ('list') without mentioning pagination behavior (implied by 'max_keys'), rate limits, authentication needs, or what 'TOS objects' entails (e.g., files, metadata). This is inadequate for a tool with multiple parameters and no output schema.

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 a single, efficient sentence with no wasted words. However, it's overly concise to the point of under-specification, lacking necessary context for effective use, which slightly reduces its score from perfect.

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?

Given the tool's complexity (4 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain return values, error conditions, or behavioral nuances like pagination. For a list operation in a storage system, more context is needed to guide the agent effectively.

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%, so the schema fully documents all parameters (bucket_name, delimiter, max_keys, prefix). The description adds no additional meaning beyond what's in the schema, such as explaining how 'delimiter' affects listing or the purpose of 'prefix'. Baseline 3 is appropriate as the schema handles parameter documentation.

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

Purpose3/5

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

The description '列举 TOS 对象' (List TOS objects) states a clear verb ('list') and resource ('TOS objects'), but it's vague about scope and doesn't distinguish from siblings like 'tos_list_buckets'. It doesn't specify whether this lists objects within a bucket or across all buckets, leaving ambiguity.

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. It doesn't mention prerequisites (e.g., needing a bucket), exclusions, or how it differs from sibling tools like 'tos_list_buckets' or 'tos_get_object', leaving the agent to infer usage from context 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/jneless/tos-mcp'

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