Sign in

    moonbitstack/moonmcp/tools does not have a README file

    Tool

    A registered tool.
    impl Component for Tool

    Tool::convert_result

    fn Tool::convert_result(self : Tool, raw_value : Json) -> ToolResult raise
    FastMCPError

    Convert a raw return value to a ToolResult, honouring the declared output schema.

    Tool::dispatch

    async fn Tool::dispatch(self : Tool, arguments : Map[String, Json]) -> ToolResult raise
    FastMCPError

    Server entry point for tool execution; subclasses customise dispatch by supplying a different run_fn at construction.

    Tool::get_meta

    fn Tool::get_meta(self : Tool) -> Map[String, Json]

    Tool::identifier

    fn Tool::identifier(self : Tool) -> String

    Tool::key

    fn Tool::key(self : Tool) -> String

    Tool::new

    fn Tool::new(name : String, parameters~ : Json, run_fn~ : async (Map[String, Json]) -> ToolResult raise
    FastMCPError
    , version? : String, title? : String, description? : String, icons? : Array[
    Icon
    ], tags? :
    Set
    [String], meta? : Map[String, Json], annotations? :
    ToolAnnotations
    , output_schema? : Json, execution? :
    ToolExecution
    , timeout? : Double, task_config? :
    TaskConfig
    ) -> Tool raise
    FastMCPError

    Register a tool. parameters is the JSON schema of its arguments and run_fn executes it.

    Tool::run

    async fn Tool::run(self : Tool, arguments : Map[String, Json]) -> ToolResult raise
    FastMCPError

    Run the tool with arguments.

    Tool::to_mcp_tool

    Convert the tool to its wire representation.

    Title precedence: explicit title, then annotation title, then a title derived from the name.

    ToolResult

    pub(all) struct ToolResult {
    content : Array[
    ContentBlock
    ]
    structured_content : Map[String, Json]?
    meta : Map[String, Json]?
    is_error : Bool
    raw_mcp_result :
    CallToolResult
    ?
    input_required :
    InputRequiredResult
    ?
    } derive(Eq,
    Debug
    )

    The canonical result of running a tool.

    ToolResult::equal

    fn ToolResult::equal(ToolResult, ToolResult) -> Bool

    ToolResult::from_mcp_result

    Wrap a protocol result while preserving its exact wire representation.

    ToolResult::input_required

    Wrap a client-input ask (SEP-2322) as an ordinary tool result.

    ToolResult::is_input_required

    fn ToolResult::is_input_required(self : ToolResult) -> Bool

    Whether this result carries a client-input ask (SEP-2322).

    ToolResult::new

    fn ToolResult::new(content? : Array[
    ContentBlock
    ], structured_content? : Map[String, Json], meta? : Map[String, Json], is_error? : Bool) -> ToolResult raise
    FastMCPError

    Create a tool result from explicit parts; content or structured content must be provided.

    ToolResult::not_equal

    fn ToolResult::not_equal(x : ToolResult, y : ToolResult) -> Bool

    ToolResult::to_mcp_result

    Convert to the protocol result, keeping the original wire representation when one was preserved.

    convert_to_content

    Convert a raw result to a sequence of content blocks.

    default_title

    fn default_title(name : String) -> String

    Derive a display title from a tool name.

    The MCP spec says clients should fall back to name for display when title is absent, but some clients instead drop the tool entirely. Always emitting a title avoids depending on that fallback.

    is_valid_tool_name

    fn is_valid_tool_name(name : String) -> Bool

    Whether a tool name is valid per the MCP specification (SEP-986): 1-64 characters of letters, digits, underscores and hyphens.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io