colmugx/mcp/protocol/tool does not have a README file

    Tool

    pub(open) trait Tool {
    fn name(Self) -> String
    fn description(Self) -> String
    fn params(Self) -> Array[ParamDef]
    async fn execute(Self, Json) -> ToolCallOutcome
    }

    Core Tool trait following MCP protocol

    ParamDef

    pub(all) struct ParamDef {
    name : String
    description : String
    type_ : String
    required : Bool
    } derive(Eq,
    Debug
    )

    Parameter definition for tool schema

    ToolCallOutcome

    pub(all) enum ToolCallOutcome {
    Complete(ToolResult)
    InputRequired(input_requests~ : Map[String,
    InputRequestEntry
    ], state~ : Json)
    } derive(Eq,
    Debug
    )

    Outcome of a tool execution. Per the 2026-07-28 MRTR pattern, a tool may either complete normally (Complete) or request additional client input (InputRequired). On retry, the client resubmits with inputResponses and the echoed requestState; the tool then receives those responses via its arguments and returns Complete.

    ToolResult

    pub struct ToolResult {
    content : Array[
    ContentItem
    ]
    is_error : Bool
    } derive(Eq,
    Debug
    )

    Tool execution result following MCP protocol format

    ToolResult::error

    fn ToolResult::error(message : String) -> ToolResult

    Create an error result with error message

    ToolResult::success

    Create a successful result with multiple content items

    ToolResult::text

    fn ToolResult::text(text : String) -> ToolResult

    Create a successful result with text content

    get_number

    fn get_number(json : Json, key : String) -> Result[Double, ToolResult]

    Extract number from JSON, returning error ToolResult on failure

    get_optional_number

    fn get_optional_number(json : Json, key : String) -> Result[Double?, ToolResult]

    Extract optional number from JSON

    get_optional_string

    fn get_optional_string(json : Json, key : String) -> Result[String?, ToolResult]

    Extract optional string from JSON

    get_string

    fn get_string(json : Json, key : String) -> Result[String, ToolResult]

    Extract string from JSON, returning error ToolResult on failure

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io