Skip to content

[BUG] tools[21].function.name': string too long. Expected a string with maximum length 64, but got a string with length 65 instead. #3523

@Racle

Description

@Racle

Description

Tool name is too long. This was taken from logs.
Opencode does not send any error message to TUI, it just will die silently.
And it also do not process any more request when tool name is too long, even when unrelated to MCP servers.

Might be related to this: https://github.com/sst/opencode/blob/a0541ba57aebcdb21c36540f0efd8a251fdbc2b8/packages/opencode/src/mcp/index.ts#L207-L209

This generates tool name from mcp name + tool name.
It would be better to set that max size to 64 characters to fix this issue.

Same issue was in ravitemer/mcphub.nvim#243 and limiting tool length fixed it. In difference, mcphub.nvim throws an error to user.

OpenCode version

0.15.23

Steps to reproduce

  1. Change MCP server to long name (60+ characters)
  2. Try to use opencode with any MCP server
  3. Opencode will just die silently after running "generating" for second

Screenshot and/or share link

Image

Operating System

Pop_os 22.04.

Terminal

Kitty, tmux, nvim with sidekick.nvim

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