Skip to main content

Module inject

Module inject 

Source
Expand description

Argument injection middleware for tool calls.

Merges default or per-tool arguments into tool call requests before they reach the backend. Useful for injecting timeouts, safety caps, or read-only flags without requiring clients to set them.

§Configuration

[[backends]]
name = "db"
transport = "http"
url = "http://db.internal:8080"

# Inject into all tool calls for this backend
[backends.default_args]
timeout = 30

# Inject into a specific tool (overrides default_args for matching keys)
[[backends.inject_args]]
tool = "query"
args = { read_only = true, max_rows = 1000 }

# Overwrite existing arguments
[[backends.inject_args]]
tool = "dangerous_op"
args = { dry_run = true }
overwrite = true

Structs§

InjectArgsLayer
Tower layer that produces an InjectArgsService.
InjectArgsService
Argument injection middleware.
InjectionRules
Resolved injection rules for a single backend namespace.