Skip to main content
Glama
qiniu

Qiniu MCP Server

Official
by qiniu

cdn_prefetch_urls

Prefetch URLs on Qiniu CDN to proactively cache resources and reduce latency for users by submitting up to 60 URLs for automatic retrieval and storage on cache nodes.

Instructions

Newly added resources are proactively retrieved by the CDN and stored on its cache nodes in advance. Users simply submit the resource URLs, and the CDN automatically triggers the prefetch process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlsYesList of individual URLs to prefetch (max 60 items). Must be full URLs with protocol, e.g. 'http://example.com/file.zip'

Implementation Reference

  • MCP tool handler for 'cdn_prefetch_urls'. Parses kwargs, calls CDNService.prefetch_urls, formats status/error/quota info into TextContent response.
    def prefetch_urls(self, **kwargs) -> list[types.TextContent]:
        ret = self._cdn.prefetch_urls(**kwargs)
    
        rets = _build_base_list(ret.code, ret.error, ret.requestId)
        if ret.invalidUrls:
            rets.append(f"Invalid URLs: {ret.invalidUrls}")
        if ret.code // 100 == 2:
            if ret.quotaDay is not None:
                rets.append(f"Today's prefetch quota: {ret.quotaDay}")
            if ret.surplusDay is not None:
                rets.append(f"Today's remaining quota: {ret.surplusDay}")
    
        return [
            types.TextContent(
                type="text",
                text="\n".join(rets),
            )
        ]
  • Input schema definition for the cdn_prefetch_urls tool, specifying urls as array of URIs (1-60 items).
    types.Tool(
        name="cdn_prefetch_urls",
        description="Newly added resources are proactively retrieved by the CDN and stored on its cache nodes in advance. Users simply submit the resource URLs, and the CDN automatically triggers the prefetch process.",
        inputSchema={
            "type": "object",
            "additionalProperties": False,
            "properties": {
                "urls": {
                    "type": "array",
                    "description": "List of individual URLs to prefetch (max 60 items). Must be full URLs with protocol, e.g. 'http://example.com/file.zip'",
                    "items": {
                        "type": "string",
                        "format": "uri",
                        "pattern": "^https?://",
                        "examples": [
                            "https://cdn.example.com/images/photo.jpg",
                            "http://static.example.com/downloads/app.exe",
                        ],
                    },
                    "maxItems": 60,
                    "minItems": 1,
                }
            },
            "required": ["urls"],
        },
    )
  • Registers the prefetch_urls tool handler using auto_register_tools in the register_tools function.
    tools.auto_register_tools(
        [
            tool_impl.refresh,
            tool_impl.prefetch_urls,
        ]
    )
  • Core implementation of prefetch_urls in CDNService, invoking qiniu CdnManager.prefetch_urls and validating response.
    def prefetch_urls(self, urls: List[str] = []) -> PrefetchUrlsResult:
        if not urls:
            raise ValueError("urls is empty")
        info, resp = self._cdn_manager.prefetch_urls(urls)
        _raise_if_resp_error(resp)
        return PrefetchUrlsResult.model_validate(info)
  • Pydantic BaseModel schema for the result of prefetch_urls operation, including code, error, quotas, etc.
    class PrefetchUrlsResult(BaseModel):
        code: Optional[int] = None
        error: Optional[str] = None
        requestId: Optional[str] = None
        invalidUrls: Optional[List[str]] = None
        quotaDay: Optional[int] = None
        surplusDay: Optional[int] = None
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the CDN 'automatically triggers the prefetch process' and stores resources 'in advance,' which implies a write/mutation operation, but doesn't disclose behavioral traits like rate limits, permissions needed, whether it's idempotent, or what happens on failure. For a mutation tool with zero annotation coverage, 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two sentences that efficiently explain the tool's function. It's front-loaded with the core purpose and avoids unnecessary details. However, it could be slightly more structured by explicitly naming the tool or separating key points.

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 (a mutation operation with no annotations and no output schema), the description is incomplete. It doesn't cover important aspects like what the tool returns, error handling, or side effects. For a CDN prefetch tool that modifies cache state, more context is needed to ensure safe and effective use.

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 the 'urls' parameter thoroughly (e.g., max 60 items, full URLs with protocol). The description adds minimal value beyond the schema by mentioning 'resource URLs' and 'prefetch process,' but doesn't provide additional semantics like URL formatting rules or usage examples not in the schema. Baseline 3 is appropriate when 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: 'proactively retrieved by the CDN and stored on its cache nodes in advance' and 'submit the resource URLs, and the CDN automatically triggers the prefetch process.' It specifies the verb (prefetch/retrieve) and resource (URLs/CDN cache), but doesn't explicitly distinguish it from sibling tools like 'cdn_refresh' which might have overlapping functionality.

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 mentions 'newly added resources' but doesn't specify prerequisites, timing, or compare it to siblings like 'cdn_refresh' (which might refresh existing cache) or other CDN-related tools. Usage context is implied but not explicit.

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