Assert zero-tool capability behavior for comma-only allowlist

This commit is contained in:
Meta Vens 2026-12-03 21:00:00 +01:00
commit dac5c93d14

View file

@ -164,8 +164,16 @@ async function main(): Promise<void> {
process.env.VOIDBOT_MCP_TOOL_ALLOWLIST = ",";
await withConnectedClient(context, async (client) => {
const listed = await client.listTools();
assert.deepEqual(listed.tools.map((tool) => tool.name), [], "[comma-only] Expected 0 tools");
assert.equal(
client.getServerCapabilities()?.tools,
undefined,
"[comma-only] Expected no tools capability to be advertised",
);
await assert.rejects(
() => client.listTools(),
/Method not found|-32601/,
"[comma-only] Expected listTools to fail closed when zero tools are registered",
);
await assertToolRefused(client, {
name: "get_exact_source_document",
arguments: { sourceId: "ExampleRepo:README.md" },