Path: redb-route/redb.Route.Llm.Tools/JsonPathTool.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.Tools/JsonPathTool.cs ---- using redb.Route.Abstractions; using redb.Route.Core; using redb.Route.Llm.Abstractions.Tools; using redb.Route.Llm.Extensions; namespace redb.Route.Llm.Tools; /// /// Standalone RouteBuilder wrapper that mounts /// behind a tool route. Prefer the /// DSL extension .JsonPath(opts) on any existing route — this shim is /// only useful when you want a self-contained RouteBuilder to hand to /// context.AddRoutes(...). /// public sealed class JsonPathTool : RouteBuilder { private const string InputSchema = """ { "type": "object", "properties": { "json": { "type": "string", "description": "JSON document to query." }, "path": { "type": "string", "description": "JsonPath expression (full Newtonsoft dialect)." } }, "required": ["json", "path"], "additionalProperties": false } """; private readonly JsonPathOptions _options; /// Creates the tool with default options. public JsonPathTool() : this(new JsonPathOptions()) { } /// Creates the tool with the given options. public JsonPathTool(JsonPathOptions options) { _options = options ?? throw new ArgumentNullException(nameof(options)); } /// protected override void Configure() => From(_options.EndpointUri) .AsLlmTool(_options.ToolName) .Description("Extracts a value from a JSON document via JsonPath (Newtonsoft dialect: " + "recursive '..', wildcards '[*]', filters '[?...]', slices). Returns the matched " + "value as JSON, or null when nothing matches.") .Input(InputSchema) .SideEffect(ToolSideEffect.ReadOnly) .Cost(ToolCostClass.Cheap) .Then() .JsonPath(_options); }