Expand description
Tool aliasing middleware for the proxy.
Rewrites tool names in list responses and call requests based on per-backend alias configuration. This lets operators expose backend tools under different names without modifying the backends themselves.
§How it works
Aliasing maintains a bidirectional mapping between original and aliased
names (stored in AliasMap):
- Forward mapping (original -> alias) – applied to
ListTools,ListResources, andListPromptsresponses so clients see the aliased names. - Reverse mapping (alias -> original) – applied to
CallTool,ReadResource, andGetPromptrequests so the backend receives the original name it expects.
Names that have no alias configured pass through unchanged in both directions.
§Configuration
Aliases are configured per-backend in TOML. The from field is the
backend-local tool name (without the namespace prefix); the to field
is the new name to expose:
[[backends]]
name = "files"
transport = "stdio"
command = "file-server"
[[backends.aliases]]
from = "read_file"
to = "read"
[[backends.aliases]]
from = "write_file"
to = "write"With this config, files/read_file appears to clients as files/read,
and calling files/read is transparently forwarded to the backend as
files/read_file.
§Middleware stack position
Aliasing runs after capability filtering and search-mode filtering, so
filters operate on original names and aliases are applied last. The
ordering in proxy.rs:
- Request validation (
crate::validation) - Capability filtering (
crate::filter) - Search-mode filtering (
crate::filter) - Tool aliasing (this module)
- Composite tools (
crate::composite)
Structs§
- Alias
Layer - Tower layer that produces an
AliasService. - Alias
Map - Resolved alias mappings for all backends.
- Alias
Service - Tower service that rewrites tool names based on alias configuration.