Skip to main content
Glama
qiniu

Qiniu MCP Server

Official
by qiniu

upload_text_data

Store text content in Qiniu Cloud Storage buckets by specifying bucket name, file key, and text data, with optional overwrite control.

Instructions

Upload text data to Qiniu bucket.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYesQiniu Cloud Storage bucket Name
keyYesThe key under which a file is saved in Qiniu Cloud Storage serves as the unique identifier for the file within that space, typically using the filename.
dataYesThe data to upload.
overwriteNoWhether to overwrite the existing object if it already exists.

Implementation Reference

  • The MCP tool handler function for 'upload_text_data' that invokes the storage service method and formats the response as TextContent.
    def upload_text_data(self, **kwargs) -> list[types.TextContent]:
        urls = self.storage.upload_text_data(**kwargs)
        return [types.TextContent(type="text", text=str(urls))]
  • Input schema defining parameters for the upload_text_data tool: bucket, key, data (required), and optional overwrite.
    inputSchema={
        "type": "object",
        "properties": {
            "bucket": {
                "type": "string",
                "description": _BUCKET_DESC,
            },
            "key": {
                "type": "string",
                "description": "The key under which a file is saved in Qiniu Cloud Storage serves as the unique identifier for the file within that space, typically using the filename.",
            },
            "data": {
                "type": "string",
                "description": "The data to upload.",
            },
            "overwrite": {
                "type": "boolean",
                "description": "Whether to overwrite the existing object if it already exists.",
            },
        },
        "required": ["bucket", "key", "data"],
    }
  • Tool registration function that registers upload_text_data among other storage tools using tools.auto_register_tools.
    def register_tools(storage: StorageService):
        tool_impl = _ToolImpl(storage)
        tools.auto_register_tools(
            [
                tool_impl.list_buckets,
                tool_impl.list_objects,
                tool_impl.get_object,
                tool_impl.upload_text_data,
                tool_impl.upload_local_file,
                tool_impl.get_object_url,
            ]
        )
  • Core implementation in StorageService that handles the actual upload to Qiniu using upload_token and put_data, then returns object URLs.
    def upload_text_data(self, bucket: str, key: str, data: str, overwrite: bool = False) -> list[dict[str:Any]]:
        policy = {
            "insertOnly": 1,
        }
    
        if overwrite:
            policy["insertOnly"] = 0
            policy["scope"] = f"{bucket}:{key}"
    
        token = self.auth.upload_token(bucket=bucket, key=key, policy=policy)
        ret, info = qiniu.put_data(up_token=token, key=key, data=bytes(data, encoding="utf-8"))
        if info.status_code != 200:
            raise Exception(f"Failed to upload object: {info}")
    
        return self.get_object_url(bucket, key)
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 states the upload action but doesn't mention authentication requirements, rate limits, error conditions, or what happens upon success/failure. For a write operation with zero annotation coverage, this leaves significant gaps in understanding tool behavior.

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, focused sentence with zero wasted words. It immediately communicates the core function without unnecessary elaboration, making it easy to parse and understand quickly.

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 write operation with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens after upload, error handling, authentication needs, or how this differs from similar tools. The agent lacks critical context to use this tool 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 parameters are fully documented in the schema. The description adds no additional parameter information beyond what's already in the structured fields, meeting the baseline expectation but not providing extra value.

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 ('Upload') and target resource ('text data to Qiniu bucket'), making the purpose immediately understandable. It distinguishes from sibling 'upload_local_file' by specifying text data rather than local files, though it doesn't explicitly contrast them.

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 like 'upload_local_file' or other storage operations. The description lacks context about prerequisites, appropriate scenarios, or limitations that would help an agent choose correctly.

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/qiniu/qiniu-mcp-server'

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