Skip to content

Schema size limit exceeded when enabling full tool set of @larksuiteoapi/lark-mcp (Feishu/Lark docs MCP server) #965

Description

@iclouden

What version of Kimi Code is running?

0.18.0

Which open platform/subscription were you using?

Kimi Code

Which model were you using?

K2.7 Code

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

When the full tool set of @larksuiteoapi/lark-mcp (the official Feishu/Lark MCP server, sometimes referred to as feishu-doc) is enabled — no other MCP servers required — Kimi Code CLI fails before the first LLM turn with:

provider.api_error: 400 tools.function.parameters is not a valid moonshot flavored json schema,
details: <At path 'root': schema exceeds maximum allowed size>

What steps can reproduce the bug?

  1. Configure the official Feishu/Lark MCP server (@larksuiteoapi/lark-mcp) in ~/.kimi-code/mcp.json. The following example enables its full docx/bitable/docs tool set:
{
  "mcpServers": {
    "feishu-doc": {
      "command": "npx",
      "args": [
        "-y",
        "@larksuiteoapi/lark-mcp",
        "mcp",
        "-a", "<YOUR_FEISHU_APP_ID>",
        "-s", "<YOUR_FEISHU_APP_SECRET>",
        "--oauth",
        "-t", "docs.v1.content.get,docx.v1.documentBlockChildren.create,docx.v1.documentBlockChildren.get,docx.v1.documentBlockDescendant.create,docx.v1.documentBlock.get,docx.v1.documentBlock.list,docx.v1.documentBlock.patch,docx.v1.document.convert,docx.v1.document.create,docx.v1.document.get,docx.v1.document.rawContent,bitable.v1.app.copy,bitable.v1.app.create,bitable.v1.appDashboard.copy,bitable.v1.appDashboard.list,bitable.v1.app.get,bitable.v1.appTable.batchCreate,bitable.v1.appTable.batchDelete,bitable.v1.appTable.create,bitable.v1.appTable.delete,bitable.v1.appTableField.create,bitable.v1.appTableField.delete,bitable.v1.appTableField.list,bitable.v1.appTableField.update,bitable.v1.appTableForm.get,bitable.v1.appTableForm.patch,bitable.v1.appTable.list,bitable.v1.appTable.patch,bitable.v1.appTableRecord.batchCreate,bitable.v1.appTableRecord.batchDelete,bitable.v1.appTableRecord.batchGet,bitable.v1.appTableRecord.batchUpdate,bitable.v1.appTableRecord.create,bitable.v1.appTableRecord.delete,bitable.v1.appTableRecord.get,bitable.v1.appTableRecord.list,bitable.v1.appTableRecord.search,bitable.v1.appTableRecord.update,bitable.v1.appTableView.create,bitable.v1.appTableView.delete,bitable.v1.appTableView.get,bitable.v1.appTableView.list,bitable.v1.appTableView.patch"
      ],
      "enabled": true
    }
  }
}

(The <path>/feishu-doc-mcp.sh referenced in my local setup is just a thin wrapper around this npx @larksuiteoapi/lark-mcp command.)

  1. Run any prompt:
kimi -p "hello"
  1. The CLI exits immediately with the schema size error.

What is the expected behavior?

Kimi Code CLI should handle large MCP tool schemas without failing, for example by:

  • Raising the Moonshot API tool schema size limit
  • Compressing or truncating tool schemas before sending them
  • Lazy-loading only relevant tools per turn instead of sending all schemas every turn

Additional information

Rigorous proof that this is a cumulative schema size issue

I verified that 41 individual feishu-doc tools each work when enabled alone, including all 32 bitable_* tools and 9 smaller docx_* / docs_* tools. Then I enabled all 41 together, and the same error appeared.

This proves the failure is caused by the combined schema payload size, not by specific tools being invalid or incompatible.

Measured schema sizes (from tools/list)

Tool Schema size
docx_v1_documentBlockChildren_create 245 KB
docx_v1_documentBlockDescendant_create 192 KB
docx_v1_documentBlock_patch 36 KB
All other tools mostly 0.5–10 KB
Total for all 43 tools ~523 KB

Notably, docx_v1_documentBlockChildren_create (245 KB) and docx_v1_documentBlockDescendant_create (192 KB) each alone exceed the API limit.

Related issues

This is related to #792 and PR #808, but those appear focused on schema format sanitization (missing type, $ref, combinators). The error reported here is specifically about schema payload size, which is a separate bottleneck.

Current workaround

Use enabledTools to whitelist only the tools needed for a given task:

"feishu-doc": {
  "command": "bash",
  "args": ["<path>/feishu-doc-mcp.sh"],
  "enabled": true,
  "enabledTools": [
    "bitable_v1_appTableRecord_search",
    "bitable_v1_appTableRecord_update"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions