Skip to content

Trim whitespace around tool names on create, update and bulk create - #1655

Merged
helpcodeai merged 2 commits into
mainfrom
fix/trim-tool-names
Nov 13, 2026
Merged

helpcodeai merged 2 commits into
mainfrom
fix/trim-tool-names

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

On 13 Nov a customer saved a tool named \tdigitalocean_destroy_droplet (leading tab, pasted) from the web UI. The tool DTOs only checked @IsString() and @MaxLength(64), so the name was stored as typed. The MCP SDK then logs "Tool name validation warning" on every tools/list, and clients that check the name format may refuse the tool. Four Cloud connectors carry a name with whitespace around it today.

Tool names are now trimmed in CreateToolDto, UpdateToolDto and therefore every item of BulkCreateToolsDto, before the length check. No stricter format check: hand-made tools may already use other characters, and refusing them would break working setups. Same behaviour in Cloud and self-hosted. Names already stored are not touched.

Changes

  • parsers/tool-name.util.ts: trimToolName() (strings trimmed, anything else passed through to the validators).
  • tools.controller.ts: @Transform(trimToolName) on the name of the create and update DTOs; the three DTO classes are exported for the spec.
  • tools.controller.dto.spec.ts: runs the DTOs through the same global ValidationPipe as main.ts.

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Performance improvement
  • Other (describe below)

Testing

  • Added/updated unit tests
  • Tested manually (describe steps below)
  • No tests needed (explain why)

packages/backend after npx prisma generate:

  • npx jest src/connectors/tools.controller src/connectors/parsers/tool-name --maxWorkers=4: 3 suites, 43 tests passed.
  • npx eslint on the three files: clean. npx tsc --noEmit -p tsconfig.json: no errors.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable)
  • All existing tests pass (npm test) (connector suites locally, full suite in CI)
  • This PR has a descriptive title

Related Issues

Found in the 13 Nov Cloud log check (MCP SDK tool name validation warnings).

@helpcodeai
helpcodeai enabled auto-merge (squash) November 13, 2026 08:17
@helpcodeai
helpcodeai merged commit d7d78f4 into main Nov 13, 2026
16 checks passed
@helpcodeai
helpcodeai deleted the fix/trim-tool-names branch November 13, 2026 12:57
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant