Path: redb-route/redb.Route.Llm.Abstractions/Tools/ILlmToolDescriptor.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm.Abstractions/Tools/ILlmToolDescriptor.cs
----
using redb.Route.Abstractions;
namespace redb.Route.Llm.Abstractions.Tools;
///
/// A tool exposable to the LLM. Implementations are declarative — they carry the
/// shown to the model and a
/// hook that the engine uses to dispatch the call onto a redb.Route endpoint via
/// IProducerTemplate.RequestBody.
///
/// Descriptors are typically registered as DI singletons (they are stateless metadata).
/// Per-call state is not carried by the descriptor: the engine dispatches the tool on a
/// linked child of the agent exchange, so the parent's Properties,
/// RouteId, DI scope (hence every scoped service the conversation resolved) and
/// ambient transaction are the tool's as well.
///
///
/// Headers are the exception — they are filtered, not inherited. A tool receives
/// the conversation id, both correlation-id spellings, the run's resolved principal
/// (llm.user.id) and its resolved audit tags (llm.audit.*), plus whatever
/// the route author named via .PropagateToolHeaders(...). The inbound transport's
/// header set is never forwarded implicitly. See ToolHeaderPolicy in
/// redb.Route.Llm.
///
///
public interface ILlmToolDescriptor
{
///
/// Capability metadata the engine projects to the provider (name, description, input schema)
/// and consults for governance: (approval gate),
/// (claims), and
/// (cache and replay de-duplication). Safety never reaches
/// the wire — see for the per-field status.
///
LlmToolCapability Capability { get; }
///
/// Computes the endpoint URI to which the engine forwards the tool call.
/// May return a static URI (e.g. direct:sql-readonly) or build one
/// dynamically from the input JSON (e.g. http://{input.url}).
///
/// Tool input — JSON object matching .
///
/// Parent exchange of the agent route — read-only view of the run for address
/// building (headers, properties, DI scope). Note that only what this method
/// encodes into the returned URI, plus the propagated header set, reaches the
/// tool route; do not use it to smuggle per-call state.
///
/// The endpoint URI the engine will dispatch to.
string BuildEndpointUri(string inputJson, IExchange parentExchange);
}