MoonshotAI / MoonshotAI/kimi-code

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

Open
#965 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the full server configuration in ~/.kimi-code/mcp.json, then trace MCP tool-schema handling before the first LLM turn. Review the context from #792 and PR #808 while keeping this issue's size-specific failure separate from schema-format sanitization. Done means the full tool set no longer causes a Moonshot schema-size error, with a clear strategy for handling large schemas.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.