Skip to content

Honor control-plane tool name aliases - #56

Merged
lucarlig merged 6 commits into
mainfrom
user/luca/cp-parity-tool-names
Jul 14, 2026
Merged

Honor control-plane tool name aliases#56
lucarlig merged 6 commits into
mainfrom
user/luca/cp-parity-tool-names

Conversation

@lucarlig

@lucarlig lucarlig commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem

The gateway previously derived federated tool names by reimplementing control-plane slugification. The corrected control-plane contract publishes the exact protocol-visible custom name plus its upstream original name, so local slugification loses valid casing, dots, and underscores and duplicates naming policy.

Summary

  • deserialize the optional tool_name_aliases mapping published by the control plane
  • treat backend map keys as stable gateway UUIDs while keeping those IDs out of aliased tool names
  • advertise each exact custom name and route calls back to the mapped upstream original name
  • retain {backend-id}-{tool} advertisement and routing for older configs without aliases
  • remove the local slugifier and Unicode normalization dependency
  • regenerate the user-config schema and cover exact aliases, UUID backend keys, and legacy fallback

Pairs with IBM/mcp-context-forge#5553, which publishes UUID-keyed backends and {exposed_name: original_name} aliases for virtual-server tools.

Validation

  • cargo test -p contextforge-gateway-rs-apis
  • cargo test -p contextforge-gateway-rs-lib
  • cargo clippy -p contextforge-gateway-rs-apis --all-targets -- -D warnings
  • cargo clippy -p contextforge-gateway-rs-lib --all-targets -- -D warnings
  • cargo fmt --all -- --check

The gateway namespaced federated tools as {backend}-{raw_name}, which
diverges from the control plane's naming for the same virtual server
whenever the upstream tool name contains non-slug characters (e.g.
get_stats vs fast-time-get-stats). Slugify the tool part when
advertising and map it back to the upstream's original name on
tools/call via the backend's published allowed_tool_names, so clients
see identical names on both planes.

Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig requested a review from dawid-nowak July 8, 2026 13:37
lucarlig added 2 commits July 8, 2026 14:53
cp_slug approximated the control plane's slugify for ASCII only, so
tool names containing accents, contractions, or other non-ASCII
characters would diverge between the planes. Port the full algorithm
in the control plane's order — unicode lowercase, contraction
apostrophe removal, non-word runs to single trimmed hyphens, the
ae/ss/o special-character map, NFKD decomposition keeping ASCII —
with test vectors generated from mcpgateway.utils.create_slug.slugify,
including the dropped-prefix separator behavior for undecomposable
characters.

Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig lucarlig changed the title Advertise control-plane slug names for federated tools Honor control-plane tool name aliases Jul 13, 2026
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig lucarlig self-assigned this Jul 14, 2026
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig merged commit e7dacca into main Jul 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants