Keep VoidBot MCP alive across deployments
This commit is contained in:
parent
a21d173ec0
commit
03edb8fffc
9 changed files with 120 additions and 12 deletions
|
|
@ -22,18 +22,38 @@ const client = new Client({ name: "voidbot-remote-mcp-smoke", version: "1.0.0" }
|
|||
try {
|
||||
await client.connect(transport);
|
||||
const tools = await client.listTools();
|
||||
if (!tools.tools.some((tool) => tool.name === "search_history")) {
|
||||
throw new Error("Remote VoidBot MCP did not advertise search_history.");
|
||||
for (const requiredTool of ["search_history", "list_indexed_repos", "search_sources"]) {
|
||||
if (!tools.tools.some((tool) => tool.name === requiredTool)) {
|
||||
throw new Error(`Remote VoidBot MCP did not advertise ${requiredTool}.`);
|
||||
}
|
||||
}
|
||||
const result = await client.callTool({
|
||||
const historyResult = await client.callTool({
|
||||
name: "search_history",
|
||||
arguments: { query: "VoidBot deployment Yggdrasil", limit: 2 },
|
||||
});
|
||||
if (result.isError) {
|
||||
const detail = result.content?.map((entry) => entry.type === "text" ? entry.text : entry.type).join(" ");
|
||||
if (historyResult.isError) {
|
||||
const detail = historyResult.content?.map((entry) => entry.type === "text" ? entry.text : entry.type).join(" ");
|
||||
throw new Error(`Remote search_history failed: ${detail || "unknown MCP error"}`);
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify({ ok: true, toolCount: tools.tools.length, result }, null, 2)}\n`);
|
||||
const repositoriesResult = await client.callTool({ name: "list_indexed_repos", arguments: {} });
|
||||
if (repositoriesResult.isError) {
|
||||
throw new Error("Remote list_indexed_repos failed.");
|
||||
}
|
||||
const sourceResult = await client.callTool({
|
||||
name: "search_sources",
|
||||
arguments: { query: "VoidBot indexed source retrieval", limit: 2 },
|
||||
});
|
||||
if (sourceResult.isError) {
|
||||
const detail = sourceResult.content?.map((entry) => entry.type === "text" ? entry.text : entry.type).join(" ");
|
||||
throw new Error(`Remote search_sources failed: ${detail || "unknown MCP error"}`);
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
ok: true,
|
||||
toolCount: tools.tools.length,
|
||||
historyResult,
|
||||
repositoriesResult,
|
||||
sourceResult,
|
||||
}, null, 2)}\n`);
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue