opencode-strip-empty-params-pluginStrips empty-string values from non-required MCP tool-call arguments before the call reaches the server. Fixes LLM function-calling quirks where models emit every optional key with an empty default.
0
410
近 7 天 10
32.6
生态多维模型
2 个月前
2026-06-12
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-strip-empty-params-plugin@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-strip-empty-params-plugin@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-strip-empty-params-pluginopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
An opencode plugin that strips empty-string values from non-required MCP tool-call arguments before the call reaches the server.
Problem
Some LLMs (notably OpenAI GPT-family models) always emit every JSON key defined
in a tool's input schema, filling optional parameters with empty strings, zeros,
or false even when no value was intended.
Several MCP servers treat "" differently from an absent key. For example,
Slack's MCP server returns zero results when cursor: "" is passed, even though
omitting cursor entirely works correctly. This makes the same MCP tool work
with one model family and silently fail with another.
How it works
The plugin hooks tool.execute.before and, for each MCP tool call, removes any
argument whose value is "" and whose key is not in the tool schema's
required array.
Required parameters are never touched so genuine validation errors still surface.
Installation
# in opencode.json
{
"plugin": [
"opencode-strip-empty-params-plugin"
// or with options:
// ["opencode-strip-empty-params-plugin", { "scope": "all", "verbose": true }]
]
}
Options
| Option | Type | Default | Description |
|---|---|---|---|
scope |
"mcp" | "all" |
"mcp" |
Which tools to apply to |
verbose |
boolean |
false |
Log each stripped key to stderr for debugging |
Links
Publishing
This package publishes through GitHub Actions trusted publishing from
.github/workflows/publish.yml.
For maintainer release steps and verification, use:
.claude/skills/publish-package/SKILL.md