Skip to main content
Glama
qiniu

Qiniu MCP Server

Official
by qiniu

get_object_url

Generate download URLs for files stored in Qiniu Cloud Storage buckets, with options for SSL configuration and token expiration for private buckets.

Instructions

Get the file download URL, and note that the Bucket where the file is located must be bound to a domain name. If using Qiniu Cloud test domain, HTTPS access will not be available, and users need to make adjustments for this themselves.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYesQiniu Cloud Storage bucket Name
keyYesKey of the object to get.
disable_sslNoWhether to disable SSL. By default, it is not disabled (HTTP protocol is used). If disabled, the HTTP protocol will be used.
expiresNoToken expiration time (in seconds) for download links. When the bucket is private, a signed Token is required to access file objects. Public buckets do not require Token signing.

Implementation Reference

  • MCP tool handler implementation for 'get_object_url'. It delegates to StorageService.get_object_url and formats the response as TextContent.
    def get_object_url(self, **kwargs) -> list[types.TextContent]:
        urls = self.storage.get_object_url(**kwargs)
        return [types.TextContent(type="text", text=str(urls))]
  • Tool schema definition including name, description, and inputSchema for 'get_object_url'.
    types.Tool(
        name="get_object_url",
        description="Get the file download URL, and note that the Bucket where the file is located must be bound to a domain name. If using Qiniu Cloud test domain, HTTPS access will not be available, and users need to make adjustments for this themselves.",
        inputSchema={
            "type": "object",
            "properties": {
                "bucket": {
                    "type": "string",
                    "description": _BUCKET_DESC,
                },
                "key": {
                    "type": "string",
                    "description": "Key of the object to get.",
                },
                "disable_ssl": {
                    "type": "boolean",
                    "description": "Whether to disable SSL. By default, it is not disabled (HTTP protocol is used). If disabled, the HTTP protocol will be used.",
                },
                "expires": {
                    "type": "integer",
                    "description": "Token expiration time (in seconds) for download links. When the bucket is private, a signed Token is required to access file objects. Public buckets do not require Token signing.",
                },
            },
            "required": ["bucket", "key"],
        },
    )
  • Registration of the 'get_object_url' tool handler 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 helper function in StorageService that generates public and private download URLs for objects using Qiniu SDK.
    def get_object_url(
            self, bucket: str, key: str, disable_ssl: bool = False, expires: int = 3600
    ) -> list[dict[str:Any]]:
        # 获取下载域名
        domains_getter = getattr(self.bucket_manager, "_BucketManager__uc_do_with_retrier")
        domains_list, domain_response = domains_getter('/v3/domains?tbl={0}'.format(bucket))
        if domain_response.status_code != 200:
            raise Exception(
                f"get bucket domain error:{domain_response.exception} reqId:{domain_response.req_id}"
            )
    
        if not domains_list or len(domains_list) == 0:
            raise Exception(
                f"get bucket domain error:domains_list is empty reqId:{domain_response.req_id}"
            )
    
        http_schema = "https" if not disable_ssl else "http"
        object_public_urls = []
        for domain in domains_list:
            # 被冻结
            freeze_types = domain.get("freeze_types")
            if freeze_types is not None:
                continue
    
            domain_url = domain.get("domain")
            if domain_url is None:
                continue
    
            object_public_urls.append({
                "object_url": f"{http_schema}://{domain_url}/{key}",
                "domain_type": "cdn" if domain.get("domaintype") is None or domain.get("domaintype") == 0 else "origin"
            })
    
        object_urls = []
        bucket_info, bucket_info_response = self.bucket_manager.bucket_info(bucket)
        if domain_response.status_code != 200:
            raise Exception(
                f"get bucket domain error:{bucket_info_response.exception} reqId:{bucket_info_response.req_id}"
            )
        if bucket_info["private"] != 0:
            for url_info in object_public_urls:
                public_url = url_info.get("object_url")
                if public_url is None:
                    continue
                url_info["object_url"] = self.auth.private_download_url(public_url, expires=expires)
                object_urls.append(url_info)
        else:
            for url_info in object_public_urls:
                object_urls.append(url_info)
        return object_urls
  • Higher-level registration trigger: storage/__init__.py load() calls register_tools to register the tools including get_object_url.
    def load(cfg: config.Config):
        storage = StorageService(cfg)
        register_tools(storage)
        register_resource_provider(storage)
Behavior3/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. It adds important context about domain binding requirements and HTTPS limitations with test domains, which are not covered in the input schema. However, it doesn't describe critical behaviors like authentication needs (implied by 'expires' parameter for private buckets), rate limits, error conditions, or what the output looks like (URL format). The description provides some value but leaves significant gaps.

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 reasonably concise with two sentences. The first sentence states the core purpose, and the second adds important constraints. However, the second sentence is somewhat complex and could be structured more clearly. No wasted words, but the information density could be improved.

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?

For a tool with 4 parameters, 100% schema coverage, but no annotations and no output schema, the description provides some useful context about domain requirements and HTTPS limitations. However, it doesn't explain the return value (URL format), error conditions, or authentication implications fully. Given the complexity of URL generation with SSL and expiration considerations, the description should do more to compensate for the lack of output schema and annotations.

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 already documents all four parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions domain binding and HTTPS considerations generally but doesn't link these to specific parameters like 'disable_ssl' or 'bucket'. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose: 'Get the file download URL' specifies the verb (get) and resource (file download URL). It distinguishes from siblings like 'get_object' (which likely retrieves the object itself) by focusing on URL generation. However, it doesn't explicitly differentiate from CDN-related URL tools like 'cdn_prefetch_urls' or 'live_streaming_get_play_urls'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some usage context by mentioning domain binding requirements and HTTPS limitations with test domains, which implies when this tool is appropriate. However, it doesn't explicitly state when to use this tool versus alternatives like 'get_object' (for direct file access) or CDN tools for prefetching/refreshing URLs. No clear exclusions or prerequisites are defined.

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