Sign in

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

    Params

    pub(open) trait Params {
    fn schema() -> JsonSchema
    fn from_json(Json) -> Self raise ToolError
    fn to_json(Self) -> Json
    }

    impl Params for Bool
    impl Params for Int
    impl Params for Double
    impl Params for String
    impl Params for Option[T]
    impl Params for Array[T]

    ToolError

    pub suberror ToolError {
    ToolError(String)
    }

    FieldDef

    type FieldDef

    FieldDef represents a single field definition

    JsonSchema

    pub struct JsonSchema {
    type_name : String
    description : String
    properties : Map[String, JsonSchema]?
    required : Array[String]?
    items : JsonSchema?
    default : Json?
    } derive(
    Debug
    )

    JsonSchema::to_json

    fn JsonSchema::to_json(self : JsonSchema) -> Json

    ParamKind

    pub(all) enum ParamKind {
    String
    Integer
    Number
    Boolean
    Array(ParamKind)
    Object(Map[String, ParamKind])
    }

    SchemaBuilder

    pub struct SchemaBuilder {
    fields : Array[FieldDef]
    }

    SchemaBuilder provides a fluent API for building JSON schemas

    SchemaBuilder::build

    fn SchemaBuilder::build(self : SchemaBuilder, desc? : String) -> JsonSchema

    Build the final JsonSchema

    SchemaBuilder::field

    fn SchemaBuilder::field(self : SchemaBuilder, name : String, field_type : SchemaType, required? : Bool, desc? : String) -> SchemaBuilder

    Add a field to the schema

    SchemaType

    pub enum SchemaType {
    Str
    Int
    Num
    Bool
    Arr(SchemaType)
    Obj
    }

    SchemaType represents the type of a field in the schema

    ToolWrapper

    pub(all) struct ToolWrapper {
    name_impl : () -> String
    description_impl : () -> String
    params_impl : () -> Array[
    ParamDef
    ]
    execute_impl : (Json) ->
    ToolResult

    }

    impl Tool for ToolWrapper

    arr_schema

    fn arr_schema(item : JsonSchema, desc? : String) -> JsonSchema

    arr_type

    fn arr_type(item_type : SchemaType) -> SchemaType

    Type constructor: Array type

    bool_schema

    fn bool_schema(desc? : String) -> JsonSchema

    bool_type

    fn bool_type() -> SchemaType

    Type constructor: Boolean type

    int_schema

    fn int_schema(desc? : String) -> JsonSchema

    int_type

    fn int_type() -> SchemaType

    Type constructor: Integer type

    num_schema

    fn num_schema(desc? : String) -> JsonSchema

    num_type

    fn num_type() -> SchemaType

    Type constructor: Number type

    obj_schema

    fn obj_schema(props : Map[String, JsonSchema], required : Array[String], desc? : String) -> JsonSchema

    obj_type

    fn obj_type() -> SchemaType

    Type constructor: Object type

    schema_builder

    fn schema_builder() -> SchemaBuilder

    Create a new schema builder

    simple_tool

    fn simple_tool(name : String, description : String, handler : (Json) ->
    ToolResult
    ) -> ToolWrapper

    str_schema

    fn str_schema(desc? : String) -> JsonSchema

    str_type

    fn str_type() -> SchemaType

    Type constructor: String type

    tool_error

    fn tool_error(msg : String) -> ToolError

    tool_fn

    fn[Args : Params, Ret : ToToolResult] tool_fn(handler : (Args) -> Ret, name~ : String, description~ : String) -> ToolWrapper

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io