MiMo-Code icon indicating copy to clipboard operation
MiMo-Code copied to clipboard

websearch tool does not support Xiaomi MiMo web search plugin

Open NMDX0721 opened this issue 3 months ago • 1 comments

Issue Title

websearch tool does not support Xiaomi MiMo web search plugin

Description

The websearch tool in MiMoCode does not work with Xiaomi MiMo's "联网服务插件" (Web Search Plugin), even though the plugin is enabled on the Xiaomi MiMo platform.

Root Cause

According to Xiaomi MiMo's official documentation, the web search feature requires adding a tools parameter to the API request:

"tools": [
    {
        "type": "web_search",
        "max_keyword": 3,
        "force_search": true,
        "limit": 1,
        "user_location": {
            "type": "approximate",
            "country": "China"
        }
    }
]

However, MiMoCode's websearch tool does not include this tools parameter when calling the API. Instead, it returns a generic error:

Web search unavailable. Use `webfetch` with a relevant URL instead, or enable the Web Search plugin at https://platform.xiaomimimo.com/console/plugin.

Steps to Reproduce

  1. Enable the "联网服务插件" (Web Search Plugin) on Xiaomi MiMo platform (https://platform.xiaomimimo.com/console/plugin)
  2. Configure MiMoCode to use Xiaomi provider with a valid API key
  3. Run mimo and try to use websearch: /websearch 小米汽车
  4. Error message appears

Expected Behavior

The websearch tool should:

  1. Recognize when using Xiaomi MiMo provider
  2. Automatically add the required tools parameter with "type": "web_search" to API requests
  3. Return search results from Xiaomi MiMo's web search service

Actual Behavior

The tool returns an error suggesting to enable the plugin (which is already enabled) or use webfetch instead.

Environment

  • MiMoCode version: 0.1.10
  • Provider: Xiaomi (Token Plan)
  • Model: mimo-v2.5-pro

Reference

Official documentation: https://mimo.mi.com/docs/zh-CN/quick-start/usage-guide/text-generation/tool-calling/web-search

Suggested Fix

Update the websearch tool implementation to detect Xiaomi MiMo provider and include the appropriate tools parameter in API requests, similar to:

// For Xiaomi MiMo provider
tools: [
    {
        type: "web_search",
        max_keyword: 3,
        force_search: true,
        limit: 1
    }
]

NMDX0721 avatar Aug 06 '26 15:08 NMDX0721

Quick update for everyone hitting this: the root cause has been fully identified in #2280 — the websearch tool hardcodes the pay-as-you-go endpoint, so Token Plan keys (tp- prefix) get a 401 there, and the error is silently swallowed behind the misleading "enable the plugin / quota" message. Direct curl tests confirm the server side works fine on the Token Plan endpoint. A minimal fix is up in PR #2281, tested on macOS (Intel), Windows, and macOS (Apple Silicon).

xdecats avatar Aug 30 '26 17:08 xdecats