websearch tool does not support Xiaomi MiMo web search plugin
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
- Enable the "联网服务插件" (Web Search Plugin) on Xiaomi MiMo platform (https://platform.xiaomimimo.com/console/plugin)
- Configure MiMoCode to use Xiaomi provider with a valid API key
- Run
mimoand try to use websearch:/websearch 小米汽车 - Error message appears
Expected Behavior
The websearch tool should:
- Recognize when using Xiaomi MiMo provider
- Automatically add the required
toolsparameter with"type": "web_search"to API requests - 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
}
]
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).