本项目将POKEAPI与MCP(模型上下文协议)规范相结合,为用户提供了一个获取宝可梦信息的工具服务器。它允许LLM应用或MCP客户端通过特定协议方便地获取宝可梦的相关信息。
npm install
npx tsc
npx ts-node src/index.ts
npm test
{
"jsonrpc": "2.0",
"id": 1,
"method": "list_tools"
}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "getPokemonInfo",
"description": "从宝可梦名称或ID中,通过POKEAPI获取宝可梦信息。",
"input_schema": { ... },
"output_schema": { ... }
}
]
}
}
{
"jsonrpc": "2.0",
"id": 2,
"method": "call_tool",
"params": {
"name": "getPokemonInfo",
"arguments": {
"nameOrId": "pikachu"
}
}
}
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [
{
"type": "json",
"data": {
"name": "pikachu",
"id": 25,
"height": 4,
"weight": 60,
"types": ["electric"]
}
}
]
}
}