Table of Contents

Class HttpApiTool

Namespace
LMKit.Agents.Tools.Http
Assembly
LM-Kit.NET.dll

Runs an HttpApiToolDefinition as a tool: the model's arguments fill the URL, the query string, headers and the JSON body, the operation is called, and the answer (cut to the definition's response path and length) comes back as { status, ok, body }. A method that only reads is a low-risk read; any other is a network write that asks for approval unless the definition says otherwise. With an egress policy, every call is checked against it first and redirects are never followed.

public sealed class HttpApiTool : ITool, IToolMetadata
Inheritance
HttpApiTool
Implements
Inherited Members

Examples

var definition = HttpApiToolDefinition.FromJson(File.ReadAllText("find_customer.json"));
var agent = Agent.CreateBuilder(model)
    .WithTools(tools => tools.Register(new HttpApiTool(definition)))
    .Build();

Constructors

HttpApiTool(HttpApiToolDefinition, WebEgressPolicy, HttpClient)

Initializes a new instance.

Fields

IdempotencyHeader

The header a write carries its run's idempotency key in.

Properties

Category

Gets the category this tool belongs to.

DefaultApproval

Gets the default approval mode for this tool.

Definition

Gets the definition this tool runs.

Description

Gets a concise description of what the tool does.

InputSchema

Gets the JSON Schema defining the expected input arguments.

IsIdempotent

Gets whether the tool is idempotent (safe to retry without changing outcome).

IsReadOnly

Gets whether the tool performs only read operations with no state mutation.

Name

Gets the stable, unique identifier for this tool.

RiskLevel

Gets the inherent risk level of this tool.

SideEffect

Gets the type of side effect this tool may produce.

Methods

CallAsync(string, CancellationToken)

Calls the operation as InvokeAsync(string, CancellationToken) does and returns the whole exchange (the request as sent, the response as received, and the tool's answer), for a host that shows a test call or logs what a tool did.

InvokeAsync(string, CancellationToken)

Executes the tool with the specified JSON arguments.

Share