pub struct Tool {
pub version: String,
pub requires_filesystem: bool,
pub commands: CommandTree,
pub schema: SchemaGraph,
}Expand description
Top-level tool metadata record.
Fields§
§version: String§requires_filesystem: bool§commands: CommandTree§schema: SchemaGraphNamed-type registry shared by this tool’s commands. Typed positions in
the command tree may reference these definitions via
SchemaType::Ref. Use SchemaGraph::empty when there are no shared
definitions to declare.
The graph’s root field is a structurally-required placeholder (empty
record); only defs is consumed. The real roots are the per-position
embedded SchemaTypes.
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn command_index_by_path(&self, command_path: &[String]) -> Option<usize>
pub fn command_index_by_path(&self, command_path: &[String]) -> Option<usize>
Resolves a command-path (as passed to golem:tool invoke) to the
index of the command node whose body it selects. An empty path selects
the root command. Each segment matches a subcommand’s name or alias.
Returns None when a segment does not match or the selected command
has no body.
Sourcepub fn effective_globals(
&self,
command_index: usize,
) -> Vec<EffectiveCommandField>
pub fn effective_globals( &self, command_index: usize, ) -> Vec<EffectiveCommandField>
The inherited globals in scope for command_index, collected along the
path from the root in path order (options before flags within each
node).
Sourcepub fn canonical_input_surfaces(
&self,
command_index: usize,
) -> Vec<CanonicalSurfaceRef>
pub fn canonical_input_surfaces( &self, command_index: usize, ) -> Vec<CanonicalSurfaceRef>
The ordered canonical input surfaces of the command at command_index,
identified by their position in the tool definition (see the module
documentation for the ordering and shadowing rules).
This is the single source of the canonical field ordering: callers with richer per-surface data (such as the Rust SDK’s extended descriptor model) map each returned reference back onto their own structures by position, which stays unambiguous even for invalid tools with duplicate surface names.
Sourcepub fn canonical_field_for_surface(
&self,
command_index: usize,
surface: CanonicalSurfaceRef,
) -> Option<CanonicalInputField>
pub fn canonical_field_for_surface( &self, command_index: usize, surface: CanonicalSurfaceRef, ) -> Option<CanonicalInputField>
The canonical input field for one surface reference of the command at
command_index, or None if the reference does not resolve.
Sourcepub fn canonical_input_fields(
&self,
command_index: usize,
) -> Vec<CanonicalInputField>
pub fn canonical_input_fields( &self, command_index: usize, ) -> Vec<CanonicalInputField>
The ordered canonical input fields of the command at command_index
(see the module documentation for the ordering and shadowing rules).
Sourcepub fn canonical_input_model(
&self,
command_index: usize,
) -> Result<CanonicalInputModel, ToolValidationError>
pub fn canonical_input_model( &self, command_index: usize, ) -> Result<CanonicalInputModel, ToolValidationError>
The canonical input model of the command at command_index: the
ordered fields plus the self-contained record schema.
Sourcepub fn canonical_input_record_schema(
&self,
command_index: usize,
) -> Result<SchemaGraph, ToolValidationError>
pub fn canonical_input_record_schema( &self, command_index: usize, ) -> Result<SchemaGraph, ToolValidationError>
The self-contained record schema of the command’s canonical input: a record with one field per canonical input field, with the tool’s shared definitions projected to those reachable from the record.
Sourcepub fn decode_canonical_input_record(
&self,
command_index: usize,
value: SchemaValue,
) -> Result<Vec<CanonicalInputValue>, CanonicalInputDecodeError>
pub fn decode_canonical_input_record( &self, command_index: usize, value: SchemaValue, ) -> Result<Vec<CanonicalInputValue>, CanonicalInputDecodeError>
Decodes a canonical input record value against the command’s canonical input model.