README

mizchi/llm/tools does not have a README file

#
SchemaBuilder

pub(all) struct SchemaBuilder {
properties : Map[String, Json]
required : Array[String]
}

SchemaBuilder helps construct JSON Schema for tool input_schema.

#
SchemaBuilder::array

fn SchemaBuilder::array(self : SchemaBuilder, name : String, description : String, item_type : String, required? : Bool) -> SchemaBuilder

Add an array property with item type.

#
SchemaBuilder::boolean

fn SchemaBuilder::boolean(self : SchemaBuilder, name : String, description : String, required? : Bool) -> SchemaBuilder

Add a boolean property.

#
SchemaBuilder::build

fn SchemaBuilder::build(self : SchemaBuilder) -> Json

Build the JSON Schema object.

#
SchemaBuilder::integer

fn SchemaBuilder::integer(self : SchemaBuilder, name : String, description : String, required? : Bool) -> SchemaBuilder

Add an integer property.

#
SchemaBuilder::new

#
SchemaBuilder::number

fn SchemaBuilder::number(self : SchemaBuilder, name : String, description : String, required? : Bool) -> SchemaBuilder

Add a number property.

#
SchemaBuilder::string

fn SchemaBuilder::string(self : SchemaBuilder, name : String, description : String, required? : Bool) -> SchemaBuilder

Add a string property.

#
SchemaBuilder::string_enum

fn SchemaBuilder::string_enum(self : SchemaBuilder, name : String, description : String, values : Array[String], required? : Bool) -> SchemaBuilder

Add a string enum property.

#
ToolChoice

pub(all) enum ToolChoice {
Auto
None
Required
Specific(String)
}

ToolChoice controls how the model selects tools.

#
ToolDef

pub(all) struct ToolDef {
name : String
description : String
input_schema : Json
}

ToolDef defines a tool that can be called by the model.

#
ToolDef::new

fn ToolDef::new(name : String, description : String, input_schema : Json) -> ToolDef

#
ToolDef::to_anthropic_json

fn ToolDef::to_anthropic_json(self : ToolDef) -> Json

Convert ToolDef to Anthropic format JSON.

#
ToolDef::to_openai_json

fn ToolDef::to_openai_json(self : ToolDef) -> Json

Convert ToolDef to OpenAI format JSON.

#
ToolExecuteError

pub(all) enum ToolExecuteError {
ToolNotFound(String)
InvalidParams(tool_name~ : String, errors~ : Array[String])
}

#
ToolExecuteError::to_message

fn ToolExecuteError::to_message(self : ToolExecuteError) -> String

#
ToolRegistry

pub(all) struct ToolRegistry {
tools : Array[ToolDef]
handlers : Map[String, (Json) -> String]
}

ToolRegistry manages available tools and their handlers.

#
ToolRegistry::definitions

fn ToolRegistry::definitions(self : ToolRegistry) -> Array[Json]

#
ToolRegistry::execute

fn ToolRegistry::execute(self : ToolRegistry, name : String, input : Json) -> (String, Bool)

#
ToolRegistry::execute_result

fn ToolRegistry::execute_result(self : ToolRegistry, name : String, input : Json) -> Result[String, ToolExecuteError]

#
ToolRegistry::execute_validated

fn ToolRegistry::execute_validated(self : ToolRegistry, name : String, input : Json) -> (String, Bool)

Execute with schema validation before handler invocation.

#
ToolRegistry::get_defs

fn ToolRegistry::get_defs(self : ToolRegistry) -> Array[ToolDef]

#
ToolRegistry::has

fn ToolRegistry::has(self : ToolRegistry, name : String) -> Bool

#
ToolRegistry::new

#
ToolRegistry::register

fn ToolRegistry::register(self : ToolRegistry, name : String, description : String, input_schema : Json, handler : (Json) -> String) -> Unit

#
ToolRegistry::register_def

fn ToolRegistry::register_def(self : ToolRegistry, tool : ToolDef, handler : (Json) -> String) -> Unit

#
clamp

fn clamp(v : Int, min_v : Int, max_v : Int) -> Int

#
count_occurrences

fn count_occurrences(text : String, needle : String) -> Int

#
guard_command

fn guard_command(command : String, restrict_to_workspace : Bool) -> String?

#
normalize_path

fn normalize_path(path : String) -> String

#
optional_int

fn optional_int(obj : Json, key : String) -> Int?

#
optional_string

fn optional_string(obj : Json, key : String) -> String?

#
required_string

fn required_string(obj : Json, key : String) -> String?

#
resolve_path

fn resolve_path(path : String, allowed_dir : String?) -> Result[String, String]

#
validate_params

fn validate_params(input : Json, schema : Json) -> Array[String]

#
validate_tool_input

fn validate_tool_input(input : Json, schema : Json) -> Array[String]

#
validate_url

fn validate_url(url : String) -> Result[Unit, String]

#
web_fetch_result_json

fn web_fetch_result_json(url : String, final_url : String, status : Int, extractor : String, text : String, truncated : Bool) -> String

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io