tools
This commit is contained in:
parent
51cde09845
commit
38e1c8b2b9
1 changed files with 189 additions and 10 deletions
|
|
@ -30,6 +30,19 @@ wss.on("connection", (ws: WebSocket) => {
|
|||
} else if (command.type === "getPrompt" && command.name) {
|
||||
const prompt = await mcpClient.getPrompt(command.name);
|
||||
ws.send(JSON.stringify({ type: "prompt", data: prompt }));
|
||||
} else if (command.type === "listTools") {
|
||||
const tools = await mcpClient.listTools();
|
||||
ws.send(JSON.stringify({ type: "tools", data: tools }));
|
||||
} else if (
|
||||
command.type === "callTool" &&
|
||||
command.name &&
|
||||
command.params
|
||||
) {
|
||||
const result = await mcpClient.callTool(
|
||||
command.name + "asdf",
|
||||
command.params,
|
||||
);
|
||||
ws.send(JSON.stringify({ type: "toolResult", data: result }));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
|
|
|
|||
Loading…
Reference in a new issue