// Generated by moonmcp from tools.mbt. Edit those files, not this one.
///|
pub fn register(mcp : @moonmcp.Server) -> Unit {
mcp.tool(
"add",
args => {
ToJson::to_json(
add(@moonmcp.decode(args, "a"), @moonmcp.decode(args, "b")),
)
},
input_schema={
"type": "object",
"properties": { "a": { "type": "number" }, "b": { "type": "number" } },
"required": ["a", "b"],
},
description="Add two numbers",
)
mcp.tool(
"greet",
args => {
ToJson::to_json(
greet(
@moonmcp.decode(args, "name"),
language?=@moonmcp.decode_option(args, "language"),
),
)
},
input_schema={
"type": "object",
"properties": {
"name": { "type": "string" },
"language": { "type": "string" },
},
"required": ["name"],
},
description="Greet someone, in Chinese when asked",
)
mcp.tool(
"word_count",
args => {
ToJson::to_json(
count(
@moonmcp.decode(args, "text"),
unique?=@moonmcp.decode_option(args, "unique"),
),
)
},
input_schema={
"type": "object",
"properties": {
"text": { "type": "string" },
"unique": { "type": "boolean" },
},
"required": ["text"],
},
description="Count the words of a text",
)
mcp.resource(
"config://app",
() => ToJson::to_json(config()).stringify(),
description="The app configuration",
mime_type="application/json",
)
mcp.template(
"users://{id}/profile", params => profile(@moonmcp.decode(params, "id"))
)
mcp.prompt(
"review",
args => {
review(
@moonmcp.decode(args, "code"),
focus?=@moonmcp.decode_option(args, "focus"),
)
},
description="Ask for a code review",
arguments=[
{ name: "code", title: None, description: None, required: Some(true) },
{ name: "focus", title: None, description: None, required: Some(false) },
],
)
}