Skip to main content
Glama

sjtu_cheap_task

Route low-risk jobs such as summarize, rewrite, classify, and extract.

Instructions

Route common low-risk jobs like summarize, rewrite, classify, and extract.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYes
contentYes
image_pathNo
image_urlNo
modelNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The async function `sjtu_cheap_task` is the handler for the 'sjtu_cheap_task' MCP tool. It routes common low-risk jobs (summarize, rewrite, classify, extract, etc.) by building a routing prompt and calling the LLM API. Supports both text-only and image+text inputs, with model selection based on task type (reasoning models for 'reason'/'analyze'/'plan', text model otherwise).
    async def sjtu_cheap_task(
        task: str,
        content: str,
        image_path: str | None = None,
        image_url: str | None = None,
        model: str | None = None,
    ) -> str:
        """Route common low-risk jobs like summarize, rewrite, classify, and extract."""
        task_name = task.strip().lower()
        routing_prompt = (
            "You are handling a low-risk utility task. Be concise, accurate, and structured.\n"
            f"Task: {task_name}\n"
            "Return the useful result directly."
        )
    
        if image_path or image_url:
            response = await client.chat(
                model=model or settings.default_vision_model,
                messages=_build_vision_messages(
                    f"{routing_prompt}\n\nInput:\n{content}",
                    image_path=image_path,
                    image_url=image_url,
                    system_prompt=None,
                ),
                temperature=0.1,
            )
            return _extract_text(response)
    
        selected_model = model or (
            settings.default_reasoning_model if task_name in {"reason", "analyze", "plan"} else settings.default_text_model
        )
        response = await client.chat(
            model=selected_model,
            messages=_build_text_messages(f"{routing_prompt}\n\nInput:\n{content}", None),
            temperature=0.1,
        )
        return _extract_text(response)
  • The `@mcp.tool()` decorator on line 111 registers `sjtu_cheap_task` as an MCP tool with the FastMCP server instance `mcp`.
    @mcp.tool()
  • Helper function `_extract_text` used by the handler to extract text from the API response dictionary.
    def _extract_text(response: dict[str, Any]) -> str:
        choices = response.get("choices", [])
        if not choices:
            return "No choices returned."
        message = choices[0].get("message", {})
        content = message.get("content", "")
        if isinstance(content, str):
            return content
        if isinstance(content, list):
            chunks: list[str] = []
            for item in content:
                if isinstance(item, dict) and item.get("type") == "text":
                    chunks.append(str(item.get("text", "")))
            return "\n".join(chunk for chunk in chunks if chunk)
        return str(content)
  • Helper function `_build_vision_messages` used when the handler processes image inputs.
    def _build_vision_messages(
        prompt: str,
        *,
        image_path: str | None,
        image_url: str | None,
        system_prompt: str | None,
    ) -> list[dict[str, Any]]:
        if not image_path and not image_url:
            raise ValueError("Provide either image_path or image_url.")
    
        image_source = image_url or image_path_to_data_url(image_path or "")
        user_content = [
            {"type": "text", "text": prompt},
            {"type": "image_url", "image_url": {"url": image_source}},
        ]
    
        messages: list[dict[str, Any]] = []
        if system_prompt:
            messages.append({"role": "system", "content": system_prompt})
        messages.append({"role": "user", "content": user_content})
        return messages
  • Helper function `_build_text_messages` used by the handler for text-only inputs.
    def _build_text_messages(prompt: str, system_prompt: str | None) -> list[dict[str, Any]]:
        messages: list[dict[str, Any]] = []
        if system_prompt:
            messages.append({"role": "system", "content": system_prompt})
        messages.append({"role": "user", "content": prompt})
        return messages
Behavior2/5

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

No annotations provided, and the description only says 'low-risk jobs,' which hints at safety but does not disclose actual behavioral traits like idempotency, side effects, or permission requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, concise but lacking structure. It is front-loaded with the main purpose, but does not expand on important details, making it minimally adequate.

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

Completeness2/5

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

Given 5 parameters with no descriptions and no annotations, the description is incomplete. It does not specify valid task types, content format, or how image path/url are used, which is insufficient for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description adds no meaning to any of the 5 parameters (task, content, image_path, etc.). It fails to explain valid values or parameter purposes beyond what the schema already shows.

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 routes common low-risk jobs like summarize, rewrite, classify, and extract, giving a specific verb and resource. It distinguishes from sibling tools by implying a generic task router, though it could be more precise.

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 explicit guidance on when to use this tool versus alternatives. The description only lists example jobs, lacking when-not-to-use or comparisons with siblings like sjtu_text or sjtu_vision.

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/EternalWavee/sjtu-mcp'

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