Skip to main content

ToolHandler

Trait ToolHandler 

Source
pub trait ToolHandler<S>: Send + Sync {
    type Args: DeserializeOwned + JsonSchema + 'static;

    const ASKS_FOR_CONFIRMATION: bool = false;

    // Required method
    fn call<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        state: &'life1 S,
        ctx: &'life2 RequestContext,
        args: Self::Args,
    ) -> Pin<Box<dyn Future<Output = Result<ToolOutcome, ToolError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Implements one tool. S is the application state the protocol layer passes through, such as the database pool, config and validator client.

Provided Associated Constants§

Source

const ASKS_FOR_CONFIRMATION: bool = false

Whether call can answer ToolOutcome::NeedsConfirmation. Only then does dispatch bind the call’s arguments to a confirmation, which costs a pass over them.

Required Associated Types§

Source

type Args: DeserializeOwned + JsonSchema + 'static

The tool’s arguments; their JSON Schema is the tool’s input schema.

Required Methods§

Source

fn call<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, state: &'life1 S, ctx: &'life2 RequestContext, args: Self::Args, ) -> Pin<Box<dyn Future<Output = Result<ToolOutcome, ToolError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ToolHandler<McpState> for FindReplace

Source§

impl ToolHandler<McpState> for StructuralReplace

Source§

impl ToolHandler<McpState> for DiscardChangeset

Source§

impl ToolHandler<McpState> for ListChangesets

Source§

impl ToolHandler<McpState> for PublishChangeset

Source§

impl ToolHandler<McpState> for GetExercise

Source§

impl ToolHandler<McpState> for ListExercises

Source§

impl ToolHandler<McpState> for PatchExercise

Source§

impl ToolHandler<McpState> for Guide

Source§

impl ToolHandler<McpState> for GetHistory

Source§

impl ToolHandler<McpState> for RevertChange

Source§

impl ToolHandler<McpState> for PatchCourseSettings

Source§

impl ToolHandler<McpState> for PatchCourseStructure

Source§

impl ToolHandler<McpState> for PatchGlossaryAndReferences

Source§

impl ToolHandler<McpState> for PatchPageContent

Source§

impl ToolHandler<McpState> for ReadPublicCourse

Source§

impl ToolHandler<McpState> for GetCourseSettings

Source§

impl ToolHandler<McpState> for GetCourseStructure

Source§

impl ToolHandler<McpState> for GetGlossaryAndReferences

Source§

impl ToolHandler<McpState> for GetPageContent

Source§

impl ToolHandler<McpState> for ListCourses

Source§

impl ToolHandler<McpState> for UploadFile