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
10 in 7 days
32.6
Multi-signal model
2 months ago
2026-06-12
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-strip-empty-params-plugin@0.1.1"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-strip-empty-params-plugin@0.1.1"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-strip-empty-params-pluginopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
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