Skip to main content
Glama
qiniu

Qiniu MCP Server

Official
by qiniu

cdn_refresh

Refresh cached content on CDN nodes by marking resources as expired, ensuring users access updated versions fetched from the origin server.

Instructions

This function marks resources cached on CDN nodes as expired. When users access these resources again, the CDN nodes will fetch the latest version from the origin server and store them anew.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlsNoList of exact URLs to refresh (max 60 items). Must be full URLs with protocol, e.g. 'http://example.com/path/page.html'
dirsNoList of directory patterns to refresh (max 10 items). Must end with '/' or '/*' to indicate directory scope

Implementation Reference

  • Handler function that executes the CDN refresh logic by calling the underlying CDN service and formatting the response as text content.
    def refresh(self, **kwargs) -> list[types.TextContent]:
        ret = self._cdn.refresh(**kwargs)
        rets = _build_base_list(ret.code, ret.error, ret.requestId)
        if ret.taskIds is not None:
            # 这个可能暂时用不到
            pass
        if ret.invalidUrls:
            rets.append(f"Invalid URLs list: {ret.invalidUrls}")
        if ret.invalidDirs:
            rets.append(f"Invalid dirs: {ret.invalidDirs}")
    
        if ret.code // 100 == 2:
            if ret.urlQuotaDay is not None:
                rets.append(f"Today's URL refresh quota: {ret.urlQuotaDay}")
            if ret.urlSurplusDay is not None:
                rets.append(f"Today's remaining URL refresh quota: {ret.urlSurplusDay}")
            if ret.dirQuotaDay is not None:
                rets.append(f"Today's directory refresh quota: {ret.dirQuotaDay}")
            if ret.dirSurplusDay is not None:
                rets.append(
                    f"Today's remaining directory refresh quota: {ret.dirSurplusDay}"
                )
        return [
            types.TextContent(
                type="text",
                text="\n".join(rets),
            )
        ]
  • Tool metadata including name, description, and input schema definition for 'cdn_refresh'.
    types.Tool(
        name="cdn_refresh",
        description="This function marks resources cached on CDN nodes as expired. When users access these resources again, the CDN nodes will fetch the latest version from the origin server and store them anew.",
        inputSchema={
            "type": "object",
            "additionalProperties": False,  # 不允许出现未定义的属性
            "properties": {
                "urls": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "format": "uri",
                        "pattern": "^https?://",  # 匹配http://或https://开头的URL
                        "examples": ["http://bar.foo.com/index.html"],
                    },
                    "maxItems": 60,
                    "description": "List of exact URLs to refresh (max 60 items). Must be full URLs with protocol, e.g. 'http://example.com/path/page.html'",
                },
                "dirs": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "pattern": "^https?://.*/(\\*|$)",  # 匹配以http://或https://开头的URL,并以/或者以/*结尾的字符串
                        "examples": [
                            "http://bar.foo.com/dir/",
                            "http://bar.foo.com/images/*",
                        ],
                    },
                    "maxItems": 10,
                    "description": "List of directory patterns to refresh (max 10 items). Must end with '/' or '/*' to indicate directory scope",
                },
            }
        },
    )
  • Function that creates the tool implementation instance and registers the refresh handler (among others) with the tools system.
    def register_tools(cdn: CDNService):
        tool_impl = _ToolImpl(cdn)
        tools.auto_register_tools(
            [
                tool_impl.refresh,
                tool_impl.prefetch_urls,
            ]
        )
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 explains the core behavior (expiring cache, triggering refetch) but doesn't disclose important traits like whether this is a destructive/mutative operation (implied by 'marks as expired'), authentication requirements, rate limits, error handling, or what happens if URLs are invalid. For a mutation tool with zero annotation coverage, this 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.

Conciseness5/5

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

The description is two sentences with zero waste: the first states the action and immediate effect, the second explains the downstream consequence. It's front-loaded with the core purpose and efficiently structured without redundancy.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects like side effects, permissions, or response format, nor does it address the tool's role relative to siblings. For a tool that modifies CDN state, more context is needed to use it safely and 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 already documents both parameters ('urls' and 'dirs') with details on format, patterns, and limits. The description adds no additional parameter semantics beyond what the schema provides, but since the schema is comprehensive, the baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the specific action ('marks resources cached on CDN nodes as expired') and explains the consequence ('CDN nodes will fetch the latest version from the origin server'). It distinguishes this tool from siblings like 'cdn_prefetch_urls' (which likely preloads content) and various image/upload tools by focusing on cache invalidation rather than content retrieval or manipulation.

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 implies usage when you need to force CDN cache updates for specific resources, but it doesn't explicitly state when to use this tool versus alternatives like 'cdn_prefetch_urls' or when not to use it (e.g., for bulk operations beyond limits). The context is clear but lacks explicit guidance on alternatives or exclusions.

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