Skip to main content
Glama
qiniu

Qiniu MCP Server

Official
by qiniu

image_scale_by_size

Resizes images stored in Qiniu Cloud by specifying width or height while maintaining aspect ratio, returning a URL for direct access to the scaled image.

Instructions

Image scaling tool that resizes images based on a specified width or height and returns information about the scaled image. The information includes the object_url of the scaled image, which users can directly use for HTTP GET requests to retrieve the image content or open in a browser to view the file. The image must be stored in a Qiniu Cloud Bucket. Supported original image formats: psd, jpeg, png, gif, webp, tiff, bmp, avif, heic. Image width and height cannot exceed 30,000 pixels, and total pixels cannot exceed 150 million.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_urlYesThe URL of the image. This can be a URL obtained via the GetObjectURL tool or a URL generated by other Fop tools. Length Constraints: Minimum length of 1.
widthNoSpecifies the width for image scaling. The image will be scaled to the specified width, and the height will be adjusted proportionally.
heightNoSpecifies the height for image scaling. The image will be scaled to the specified height, and the width will be adjusted proportionally.

Implementation Reference

  • The core handler function for the image_scale_by_size tool. It takes object_url (required), optional width and height, constructs the Qiniu FOP string for thumbnail scaling, adds the processing function to the URL, and returns the new object_url.
    def image_scale_by_size(
            self, **kwargs
    ) -> list[types.TextContent]:
        object_url = kwargs.get("object_url", "")
        width = kwargs.get("width", "")
        height = kwargs.get("height", "")
        if object_url is None or len(object_url) == 0:
            return [types.TextContent(type="text", text="object_url is required")]
    
        func = f"{width}x{height}"
        if len(func) == 1:
            return [
                types.TextContent(
                    type="text", text="At least one width or height must be set"
                )
            ]
    
        func = f"imageMogr2/thumbnail/{func}"
        object_url = utils.url_add_processing_func(auth=self.auth, url=object_url, func=func)
        return [
            types.TextContent(
                type="text",
                text=str(
                    {
                        "object_url": object_url,
                    }
                ),
            )
        ]
  • Input schema for the image_scale_by_size tool, defining object_url as required string, and optional integer width/height with minimum 1, including descriptions.
    inputSchema={
        "type": "object",
        "properties": {
            "object_url": {
                "type": "string", 
                "description": _OBJECT_URL_DESC
            },
            "width": {
                "type": "integer",
                "description": "Specifies the width for image scaling. The image will be scaled to the specified width, and the height will be adjusted proportionally.",
                "minimum": 1
            },
            "height": {
                "type": "integer",
                "description": "Specifies the height for image scaling. The image will be scaled to the specified height, and the width will be adjusted proportionally.",
                "minimum": 1
            },
        },
        "required": ["object_url"]
    },
  • The register_tools function instantiates _ToolImpl and uses tools.auto_register_tools to register the image_scale_by_size handler along with other media processing tools.
    def register_tools(cfg: config.Config, cli: MediaProcessingService):
        tool_impl = _ToolImpl(cfg, cli)
        tools.auto_register_tools(
            [
                tool_impl.image_scale_by_percent,
                tool_impl.image_scale_by_size,
                tool_impl.image_round_corner,
                tool_impl.image_info,
            ]
        )
Behavior4/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 effectively describes key behaviors: the tool returns an object_url for HTTP GET access, specifies supported image formats (psd, jpeg, etc.), and outlines constraints (width/height ≤30,000 pixels, total pixels ≤150 million). It also notes proportional scaling when width or height is specified. However, it lacks details on error handling, rate limits, or authentication requirements.

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 well-structured and appropriately sized, with key information front-loaded (purpose and return value). Each sentence adds value: the first states the purpose, the second explains the object_url usage, the third specifies the bucket requirement, and the fourth lists format and size constraints. There is no redundant information, though it could be slightly more concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is largely complete. It covers purpose, return value usage, prerequisites (Qiniu Cloud Bucket), supported formats, and size constraints. However, it lacks details on output structure (beyond object_url) and error conditions, which would be helpful for an agent invoking the tool.

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 parameters thoroughly. The description adds minimal parameter semantics beyond the schema, only implying that width and height are used for proportional scaling. It does not clarify if both can be used simultaneously or their interaction. Baseline 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose: 'Image scaling tool that resizes images based on a specified width or height and returns information about the scaled image.' It specifies the verb (resizes/scales), resource (images), and distinguishes from sibling tools like image_scale_by_percent (which scales by percentage rather than dimensions) and image_info (which retrieves metadata without scaling).

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 contextual guidance: 'The image must be stored in a Qiniu Cloud Bucket' and lists supported formats and size constraints. However, it does not explicitly state when to use this tool versus alternatives like image_scale_by_percent, nor does it mention prerequisites (e.g., needing an object_url from GetObjectURL). Usage is implied but not clearly differentiated from siblings.

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