42 lines
1.3 KiB
Julia
42 lines
1.3 KiB
Julia
# "tools/list" input:
|
|
mcpServer("tools/list")
|
|
# sending out payload before smart packed by msghandler
|
|
Dict(
|
|
"method"=> "tools/list"
|
|
)
|
|
# expected return after smart unpacked by msghandler
|
|
Dict("tools" => [
|
|
Dict("toolName" => "getWeather",
|
|
"title" => "Weather Lookup",
|
|
"description" => "Fetch current weather for a city.",
|
|
"inputSchema" => Dict("type"=>"object",
|
|
"properties" => Dict("city"=>Dict("type"=>"string", "description"=>"City name"),
|
|
"units"=>Dict("type"=>"string", "enum"=>["celsius","fahrenheit"], "default"=>"celsius")),
|
|
"required" => ["city"])
|
|
)
|
|
])
|
|
|
|
# "tools/call" input:
|
|
mcpServer("tools/call", "getWeather", Dict("city"=>"Tokyo", "units"=>"celsius"))
|
|
# sending out payload before smart packed by msghandler
|
|
Dict(
|
|
"method"=> "tools/call",
|
|
"tools"=> Dict("toolName"=>"getWeather", "arguments"=>Dict("city"=>"Tokyo", "units"=>"celsius"))
|
|
)
|
|
# expected return after smart unpacked by msghandler
|
|
Dict(
|
|
"toolName"=>"getWeather",
|
|
"content": [{"type": "text", "text": "Weather in Tokyo: Sunny, 22°C"}],
|
|
"isError": false
|
|
)
|
|
|
|
# If an error occurs, mcpServer returns after smart unpacked by msghandler:
|
|
Dict(
|
|
"toolName"=>"getWeather",
|
|
"content": [],
|
|
"error": Dict("code"=>1, "message"=>"City not found"),
|
|
"isError": true
|
|
)
|
|
|
|
|