Skip to main content
Glama
onion-ai

onion-mcp-server

Official
by onion-ai

ai_summarize

Summarize long texts into bullet points, a paragraph, or a single sentence. Choose the output mode and number of points.

Instructions

对长文本进行摘要,支持要点列表、段落摘要、一句话摘要三种模式。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes要摘要的文本
modeNo摘要模式: bullets(要点列表)/ paragraph(段落)/ one_line(一句话)bullets
max_pointsNo要点数量(bullets 模式有效,默认 5)
languageNo输出语言(默认与原文相同)

Implementation Reference

  • Tool schema registration for ai_summarize with inputSchema defining required 'text', optional 'mode' (bullets/paragraph/one_line), 'max_points' (integer), and 'language' fields.
    types.Tool(
        name="ai_summarize",
        description="对长文本进行摘要,支持要点列表、段落摘要、一句话摘要三种模式。",
        inputSchema={
            "type": "object",
            "properties": {
                "text": {
                    "type":        "string",
                    "description": "要摘要的文本",
                },
                "mode": {
                    "type":        "string",
                    "description": "摘要模式: bullets(要点列表)/ paragraph(段落)/ one_line(一句话)",
                    "enum":        ["bullets", "paragraph", "one_line"],
                    "default":     "bullets",
                },
                "max_points": {
                    "type":        "integer",
                    "description": "要点数量(bullets 模式有效,默认 5)",
                    "default":     5,
                },
                "language": {
                    "type":        "string",
                    "description": "输出语言(默认与原文相同)",
                    "default":     "",
                },
            },
            "required": ["text"],
        },
    ),
  • The handler function (handle_ai) that executes ai_summarize logic: reads mode/max_points/language params, constructs LLM prompt with appropriate instruction, calls llm_call, and returns TextContent.
    elif name == "ai_summarize":
        mode       = a.get("mode", "bullets")
        max_points = int(a.get("max_points", 5))
        lang_str   = f",用{a['language']}输出" if a.get("language") else ""
    
        if mode == "bullets":
            instruction = f"提炼出最重要的 {max_points} 个要点,用 Markdown 列表格式输出{lang_str}"
        elif mode == "paragraph":
            instruction = f"写成一段连贯的摘要段落{lang_str}"
        else:  # one_line
            instruction = f"用一句话概括核心内容{lang_str}"
    
        prompt = (
            f"请对以下文本进行摘要,{instruction}。\n\n"
            f"---\n{a['text']}\n---"
        )
        reply = await llm_call(prompt)
        return [types.TextContent(type="text", text=reply)]
  • Server registration: ai_summarize (as part of AI_TOOLS) is mapped to the handle_ai handler via the _HANDLERS routing table.
    # ── 路由表 ────────────────────────────────────────────────────
    _HANDLERS: dict = {}
    for _t in AI_TOOLS:     
        _HANDLERS[_t.name] = handle_ai
  • The llm_call helper function called by the ai_summarize handler to make the actual LLM API request.
    async def llm_call(
        prompt: str,
        system: Optional[str] = None,
        temperature: float = 0.7,
    ) -> str:
        """单轮调用"""
        messages = []
        if system:
            messages.append({"role": "system", "content": system})
        messages.append({"role": "user", "content": prompt})
        return await llm_chat(messages, temperature=temperature)
Behavior2/5

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

无注释,描述承担全部责任,但仅说明摘要功能和模式,未披露处理长文本的潜在限制、输出格式或语言处理行为。

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?

仅一句话,精炼且关键信息前置,无冗余。

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?

对于摘要工具,缺少输出格式说明(无输出schema),但基本功能已覆盖,存在改进空间。

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描述覆盖100%,描述仅列举模式,未显著增加参数含义,baseline为3。

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?

明确说明工具用于对长文本进行摘要,并列出三种摘要模式,动词+资源清晰,与兄弟工具(如ai_chat、ai_extract等)有明确区分。

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?

描述未提供何时使用此工具vs替代工具的指导,没有when-to-use或when-not-to-use的说明,仅陈述功能。

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