aide/tool
Types
pub type ObjectSchema =
List(#(String, json_schema.Ref(json_schema.Schema), Bool))
The specification for an MCP tool.
This type cannot include the decoder as the decoders (and encoder) are generated from this spec. The Tool type is the runtime type that includes the decoder.
pub type Spec {
Spec(
name: String,
title: String,
description: String,
input: List(
#(String, json_schema.Ref(json_schema.Schema), Bool),
),
output: List(
#(String, json_schema.Ref(json_schema.Schema), Bool),
),
)
}
Constructors
-
Spec( name: String, title: String, description: String, input: List( #(String, json_schema.Ref(json_schema.Schema), Bool), ), output: List( #(String, json_schema.Ref(json_schema.Schema), Bool), ), )
The spec and decoder of an MCP tool.
Tools are defined with only a decoder because implementations of a tool can be sync or async.
See aide/effect.Effect for implementing tool handling.
pub type Tool(t) {
Tool(spec: Spec, decoder: decode.Decoder(t))
}
Constructors
-
Tool(spec: Spec, decoder: decode.Decoder(t))
Values
pub fn set_description(
tool: definitions.Tool,
description: String,
) -> definitions.Tool
pub fn set_title(
tool: definitions.Tool,
title: String,
) -> definitions.Tool
pub fn to_api_definition(tool: Tool(a)) -> definitions.Tool