@@ -7,15 +7,12 @@ import { Client } from "@modelcontextprotocol/client";
77import { StdioClientTransport } from "@modelcontextprotocol/client/stdio" ;
88import { MCP_STARTUP_POLICY } from "../dist/mcpStartupPolicy.js" ;
99import * as prompts from "./verify-package-prompts.mjs" ;
10- import {
11- json ,
12- verifyAvailableToolCatalog ,
13- } from "./lib/verify-package-core.mjs" ;
10+ import { json , verifyCompleteToolCatalog } from "./lib/verify-package-core.mjs" ;
1411
1512const execute = promisify ( execFile ) ;
1613
1714const verifyMcpToolsAndPrompts = async ( client , mcpOptions ) => {
18- await verifyAvailableToolCatalog ( client , mcpOptions ) ;
15+ await verifyCompleteToolCatalog ( client , mcpOptions ) ;
1916 await prompts . verifyPromptCatalog ( client , mcpOptions , prompts . names ) ;
2017 await prompts . verifyPromptCompletion ( client , mcpOptions , false ) ;
2118} ;
@@ -43,11 +40,21 @@ const verifyMcpReplay = async (client, mcpOptions, investigationReplay) => {
4340} ;
4441
4542const verifyMcpTargetFree = async ( client , mcpOptions ) => {
46- const names = ( await client . listTools ( undefined , mcpOptions ) ) . tools . map (
47- ( { name } ) => name ,
43+ const status = await client . callTool (
44+ { name : "binary_session" , arguments : { detail : "full" } } ,
45+ mcpOptions ,
4846 ) ;
49- if ( names . includes ( "current_document" ) )
50- throw new Error ( "packaged target-free MCP advertised a target-bound tool" ) ;
47+ const currentDocument =
48+ status . structuredContent ?. result ?. tool_availability ?. find (
49+ ( { name } ) => name === "current_document" ,
50+ ) ;
51+ if (
52+ currentDocument ?. available !== false ||
53+ currentDocument . reason !== "target_required"
54+ )
55+ throw new Error (
56+ "packaged target-free MCP omitted target-bound availability metadata" ,
57+ ) ;
5158} ;
5259
5360const verifyMcpUnknownProvider = async ( client , mcpOptions ) => {
@@ -96,11 +103,12 @@ const verifyMcpOpenAndBind = async (client, mcpOptions) => {
96103} ;
97104
98105const verifyMcpLinuxToolAvailability = async ( client , mcpOptions ) => {
99- const names = ( await client . listTools ( undefined , mcpOptions ) ) . tools . map (
100- ( { name } ) => name ,
106+ const current = await client . callTool (
107+ { name : "current_document" , arguments : { } } ,
108+ mcpOptions ,
101109 ) ;
102- if ( names . includes ( "current_document" ) )
103- throw new Error ( "packaged Linux MCP advertised unavailable Hopper tools " ) ;
110+ if ( current . isError !== true )
111+ throw new Error ( "packaged Linux MCP executed an unavailable Hopper tool " ) ;
104112} ;
105113
106114const verifyMcpNonLinuxCurrentDocument = async (
0 commit comments