Skip to content

List same-named tools of every connector on a server - #1309

Merged
helpcodeai merged 2 commits into
mainfrom
fix/same-name-tools-per-connector
Oct 28, 2026
Merged

helpcodeai merged 2 commits into
mainfrom
fix/same-name-tools-per-connector

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

When several connectors on one MCP server expose a tool with the same name, only the first copy was listed and every call went to the first connector. Every DATABASE connector has execute_query, get_database_schema and get_example_queries, so a server with two databases served only one of them (#1296). The same happens with two configs of one catalog provider on one server.

Now:

  • The first copy keeps the bare name, so clients that already use it keep working.
  • Every other connector's copy is listed with the connector's name as a prefix, e.g. sales_db_execute_query. The name stays within 64 characters and gets a _2 suffix if two connectors have the same name.
  • When a name is shared, each description starts with the connector's name, so the model can pick the right one.
  • Each registered tool resolves its call in its own connector (connectorIds: [tool.connectorId]), not in the server's whole list. Before, the registry returned the first connector with that name.
  • The same connector assigned twice is still skipped and logged, as before.

The executor lookup is unchanged, so the global /mcp endpoint is not affected.

Changes

  • planToolSet (mcp-endpoint.controller.ts): dedupe by connector instead of by name, prefix the extra copies, label shared names, scope execution to the tool's connector.
  • connectorScopedToolName helper, reusing slugifyForPrefix from the GraphQL built-ins.
  • Tests: names of three DATABASE copies, routing of each copy, description labels, unique names when connectors share a name, and the same-connector-twice warning. The fix(mcp): dedupe tool names so a duplicate connector can't 500 the server #313 regression test still checks that a duplicate does not 500.

Type

  • Bug fix

Testing

  • Added/updated unit tests

Commands, in packages/backend after npm ci and prisma generate:

  • npx jest src/mcp-server: 28 suites, 503 tests passed.
  • mcp-endpoint.controller.spec.ts with the old controller: 5 of 52 failed (the new tests).
  • npx tsc --noEmit -p tsconfig.json: clean.
  • npx eslint on the two changed files: clean.

Cloud and self-hosted behave the same. On a server with a single connector per tool name nothing changes.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • This PR has a descriptive title

Related Issues

Fixes #1296

@helpcodeai
helpcodeai enabled auto-merge (squash) October 28, 2026 08:36
@helpcodeai
helpcodeai merged commit 2f7572e into main Oct 28, 2026
14 checks passed
@helpcodeai
helpcodeai deleted the fix/same-name-tools-per-connector branch October 28, 2026 08:46
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

1 participant