跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    EmilioEsposito

    Strip Empty Params

    v0.1.1MCP 集成
    opencode-strip-empty-params-plugin

    Strips 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.

    GitHub 星标

    0

    月装机量

    410

    近 7 天 10

    综合评分SCORE

    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"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    npm version npm downloads license GitHub

    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

    License

    MIT