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, ] )

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