Skip to main content
Glama
onion-ai

onion-mcp-server

Official
by onion-ai

sys_url_encode

Encode or decode URL text, with option to convert spaces to plus signs or percent encoding.

Instructions

URL 编码或解码文本。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes要处理的文本
actionNoencode(编码)或 decode(解码)encode
quote_plusNo是否将空格编码为 +(默认 false,编码为 %20)

Implementation Reference

  • The actual handler function for sys_url_encode tool. Takes text, action (encode/decode), and quote_plus params. Uses urllib.parse.quote/quote_plus for encoding and unquote/unquote_plus for decoding.
    def _sys_url_encode(args: dict) -> list[types.TextContent]:
        text       = args["text"]
        action     = args.get("action", "encode")
        quote_plus = bool(args.get("quote_plus", False))
    
        try:
            if action == "encode":
                result = (
                    urllib.parse.quote_plus(text)
                    if quote_plus else urllib.parse.quote(text, safe="")
                )
            else:
                result = (
                    urllib.parse.unquote_plus(text)
                    if quote_plus else urllib.parse.unquote(text)
                )
        except Exception as e:
            return [types.TextContent(type="text", text=f"❌ {action} 失败: {e}")]
    
        return [types.TextContent(type="text", text=result)]
  • The schema definition (types.Tool) for sys_url_encode, specifying the inputSchema with text (required), action (encode/decode enum, default encode), and quote_plus (boolean, default false) parameters.
    types.Tool(
        name="sys_url_encode",
        description="URL 编码或解码文本。",
        inputSchema={
            "type": "object",
            "properties": {
                "text": {
                    "type":        "string",
                    "description": "要处理的文本",
                },
                "action": {
                    "type":        "string",
                    "description": "encode(编码)或 decode(解码)",
                    "enum":        ["encode", "decode"],
                    "default":     "encode",
                },
                "quote_plus": {
                    "type":        "boolean",
                    "description": "是否将空格编码为 +(默认 false,编码为 %20)",
                    "default":     False,
                },
            },
            "required": ["text"],
        },
    ),
  • The dispatch handler (handle_system) that routes the tool name 'sys_url_encode' to the _sys_url_encode function via a handlers dictionary.
    async def handle_system(name: str, arguments: dict) -> list[types.TextContent]:
        handlers = {
            "sys_time":       _sys_time,
            "sys_uuid":       _sys_uuid,
            "sys_hash":       _sys_hash,
            "sys_base64":     _sys_base64,
            "sys_url_encode": _sys_url_encode,
  • Registration of all SYSTEM_TOOLS (including sys_url_encode) in the _HANDLERS routing table, mapping each tool name to the handle_system function.
    for _t in SYSTEM_TOOLS: 
        _HANDLERS[_t.name] = handle_system
  • SYSTEM_TOOLS (including sys_url_encode) are aggregated into ALL_TOOLS, which is returned by the list_tools() handler.
    ALL_TOOLS: list[types.Tool] = [
        *AI_TOOLS,
        *CODE_TOOLS,
        *TEXT_TOOLS,
        *DATA_TOOLS,
        *WEB_TOOLS,
        *SYSTEM_TOOLS,
    ]
Behavior3/5

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

Annotations absent so description carries full burden. It correctly indicates a pure transformation (encode/decode), but lacks disclosure of edge cases or behavior like URL component handling beyond what schema specifies.

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?

Single sentence, front-loaded, no redundant information; efficient use of space.

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

Completeness3/5

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

Minimal but adequate for a simple utility; no output schema or behavioral details beyond encoding/decoding, but sibling tools provide similar simplicity.

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 coverage is 100%, so baseline is 3. Description adds no additional meaning beyond what schema already provides for parameters.

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?

Description clearly states it performs URL encoding or decoding (verb+resource). It differentiates from siblings by specifying URL encoding, distinct from generic text or base64 operations.

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?

No guidance on when to use this tool versus alternatives like sys_base64 or text_format; no explicit context or exclusions provided.

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/onion-ai/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server