Sign in

    moonbitstack/moonmcp/component does not have a README file

    Component

    pub(open) trait Component {
    fn base(Self) -> ComponentBase
    fn identifier(Self) -> String = _
    fn key(Self) -> String = _
    fn get_meta(Self) -> Map[String, Json] = _
    }

    A moonmcp component: tool, prompt, resource or resource template.

    ComponentBase

    pub(all) struct ComponentBase {
    key_prefix : String
    name : String
    version : String?
    title : String?
    description : String?
    icons : Array[
    Icon
    ]?
    tags :
    Set
    [String]
    meta : Map[String, Json]?
    task_config :
    TaskConfig

    }

    Common state shared by all moonmcp components.

    ComponentBase::get_meta

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

    The public meta information about the component.

    Always includes a fastmcp key containing the sorted tags list and the version (when set); internal keys (prefixed with _) are stripped from the fastmcp namespace.

    ComponentBase::key

    fn ComponentBase::key(self : ComponentBase, identifier : String) -> String

    The globally unique lookup key for a component.

    Format: "{key_prefix}:{identifier}@{version}"; the @ delimiter is always present so keys parse unambiguously even when the identifier itself contains @.

    ComponentBase::make_key

    fn ComponentBase::make_key(prefix : String, identifier : String) -> String

    Construct the lookup key for a component type, e.g. "tool:name".

    ComponentBase::new

    fn ComponentBase::new(key_prefix : String, name : String, version? : String, title? : String, description? : String, icons? : Array[
    Icon
    ], tags? :
    Set
    [String], meta? : Map[String, Json], task_config? :
    TaskConfig
    ) -> ComponentBase

    FastMCPMeta

    pub(all) struct FastMCPMeta {
    tags : Array[String]
    version : String?
    versions : Array[String]
    } derive(Eq,
    Debug
    )

    FastMCP-namespaced metadata carried in a component's _meta.

    FastMCPMeta::empty

    fn FastMCPMeta::empty() -> FastMCPMeta

    FastMCPMeta::equal

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

    FastMCPMeta::not_equal

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

    coerce_version

    fn coerce_version(value : Json?) -> String? raise
    FastMCPError

    Coerce a JSON scalar to a version string.

    Raises Validation for non-scalar values or versions containing @ (used as the key delimiter).

    get_fastmcp_metadata

    fn get_fastmcp_metadata(meta : Map[String, Json]?) -> FastMCPMeta

    Extract moonmcp metadata from a component's meta object.

    Handles both the current fastmcp namespace and the legacy _fastmcp namespace for compatibility with older servers.

    public_result_meta

    fn public_result_meta(meta : Map[String, Json]?) -> Map[String, Json]?

    Strip moonmcp's internal bookkeeping out of component meta.

    Returns None when nothing public remains, so components without user metadata keep an absent _meta rather than an empty object.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io