Skip to main content
Glama
qiniu

Qiniu MCP Server

Official
by qiniu

image_scale_by_percent

Resize images stored in Qiniu Cloud by percentage to adjust dimensions proportionally. Specify a percentage value to scale width and height, then retrieve the URL for the resized image.

Instructions

Image scaling tool that resizes images based on a percentage 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.
percentYesScaling percentage, range [1,999]. For example: 90 means the image width and height are reduced to 90% of the original; 200 means the width and height are enlarged to 200% of the original.

Implementation Reference

  • The main execution logic for the image_scale_by_percent tool. Validates inputs, constructs Qiniu FOP URL for scaling by percentage, and returns the processed image URL.
    def image_scale_by_percent(
            self, **kwargs
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        object_url = kwargs.get("object_url", "")
        percent = kwargs.get("percent", "")
        if object_url is None or len(object_url) == 0:
            return [types.TextContent(type="text", text="object_url is required")]
    
        percent_int = int(percent)
        if percent_int < 1 or percent_int > 999:
            return [
                types.TextContent(type="text", text="percent must be between 1 and 999")
            ]
    
        func = f"imageMogr2/thumbnail/!{percent}p"
        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,
                    }
                ),
            )
        ]
  • Tool metadata including name, description, and input schema defining object_url (required string) and percent (required integer 1-999).
    types.Tool(
        name="image_scale_by_percent",
        description="""Image scaling tool that resizes images based on a percentage 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.
        """,
        inputSchema={
            "type": "object",
            "properties": {
                "object_url": {
                    "type": "string", 
                    "description": _OBJECT_URL_DESC
                },
                "percent": {
                    "type": "integer",
                    "description": "Scaling percentage, range [1,999]. For example: 90 means the image width and height are reduced to 90% of the original; 200 means the width and height are enlarged to 200% of the original.",
                    "minimum": 1,
                    "maximum": 999
                },
            },
            "required": ["object_url", "percent"],
        },
    )
  • The tool handler is registered via tools.auto_register_tools in the register_tools function.
        [
            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 full burden and adds valuable behavioral context: it explains the return format (object_url for HTTP GET), storage requirements (Qiniu Cloud Bucket), format support (9 specific formats), and size constraints (width/height ≤30,000px, total ≤150M pixels). It doesn't mention error conditions, rate limits, or authentication needs, but provides substantial operational context.

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. It starts with the core purpose, explains the return value, then lists requirements and constraints. Every sentence adds value, though it could be slightly more concise by combining some constraint statements.

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?

For a 2-parameter tool with no annotations and no output schema, the description provides good context: purpose, return format, storage requirements, format support, and size constraints. It doesn't explain error cases or provide examples, but covers the essential operational context given the tool's complexity.

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 fully documents both parameters. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions the object_url can come from GetObjectURL or other Fop tools, but this is more usage guidance than parameter semantics.

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: 'Image scaling tool that resizes images based on a percentage and returns information about the scaled image.' It specifies the verb (resizes/scales), resource (images), and operation (percentage-based scaling). However, it doesn't explicitly differentiate from sibling 'image_scale_by_size' which likely scales by dimensions rather than percentage.

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 doesn't explicitly state when to use this tool versus the sibling 'image_scale_by_size' tool, nor does it mention prerequisites like authentication or rate limits.

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