Class DatabaseExecuteTool
A built-in tool for executing write SQL statements on a SQLite database.
Supports INSERT, UPDATE, DELETE, and DDL statements (CREATE, DROP, ALTER) when permitted by the configured DatabaseToolOptions.
public sealed class DatabaseExecuteTool : IBuiltInTool, ITool, IToolMetadata
- Inheritance
-
DatabaseExecuteTool
- Implements
- Inherited Members
Examples
var options = new DatabaseToolOptions { AllowWrite = true };
var executeTool = new DatabaseExecuteTool(options);
var result = await executeTool.InvokeAsync(@"{""database"":""data.db"",""sql"":""INSERT INTO users (name) VALUES (@name)"",""parameters"":{""@name"":""Alice""}}");
Constructors
- DatabaseExecuteTool()
Initializes a new instance with default options.
- DatabaseExecuteTool(DatabaseToolOptions)
Initializes a new instance with the specified options.
Properties
- Description
Gets a concise description of what the tool does.
- InputSchema
Gets the JSON Schema defining the expected input arguments.
- Name
Gets the stable, unique identifier for this tool.
Methods
- InvokeAsync(string, CancellationToken)
Executes the tool with the specified JSON arguments.