@@ -66,19 +66,12 @@ export interface ConnectServerHandle {
6666}
6767
6868/** One discovered instance in the `list-instances` payload: the registry record plus its probed MCP surface. */
69- interface IndexedTool {
70- name : string
71- title ?: string
72- description ?: string
73- inputSchema : unknown
74- outputSchema ?: unknown
75- annotations ?: unknown
76- }
69+ interface IndexedInstanceTools extends Pick < Tool , 'name' | 'title' | 'description' | 'inputSchema' | 'outputSchema' | 'annotations' > { }
7770
7871interface IndexedInstance extends Omit < DevframeInstanceRecord , 'mcp' > {
7972 mcp : {
8073 url : string
81- tools ?: IndexedTool [ ]
74+ tools ?: IndexedInstanceTools [ ]
8275 error ?: string
8376 } | null
8477 hint ?: string
@@ -252,23 +245,8 @@ async function probePort(port: number, timeoutMs?: number): Promise<DevframeInst
252245 }
253246}
254247
255- async function listInstanceTools ( sdk : ConnectSdk , url : string , token : string | undefined ) : Promise < IndexedTool [ ] > {
256- return withInstanceClient ( sdk , url , token , async ( client ) => {
257- const listed = await client . listTools ( )
258- return listed . tools . map ( toIndexedTool )
259- } )
260- }
261-
262- /** Preserve downstream tool metadata needed by an agent before invocation. */
263- export function toIndexedTool ( tool : IndexedTool ) : IndexedTool {
264- return {
265- name : tool . name ,
266- ...( tool . title ? { title : tool . title } : { } ) ,
267- ...( tool . description ? { description : tool . description } : { } ) ,
268- inputSchema : tool . inputSchema ,
269- ...( tool . outputSchema ? { outputSchema : tool . outputSchema } : { } ) ,
270- ...( tool . annotations ? { annotations : tool . annotations } : { } ) ,
271- }
248+ async function listInstanceTools ( sdk : ConnectSdk , url : string , token : string | undefined ) : Promise < IndexedInstanceTools [ ] > {
249+ return withInstanceClient ( sdk , url , token , async client => ( await client . listTools ( ) ) . tools )
272250}
273251
274252async function call (
@@ -283,7 +261,7 @@ async function call(
283261 instancesDir : options . instancesDir ,
284262 timeoutMs : options . timeoutMs ,
285263 } )
286- const record = selectInstanceRecord ( live , args . port )
264+ const record = live . find ( record => record . port === args . port && record . mcp )
287265 ?? await probePort ( args . port , options . timeoutMs )
288266 if ( ! record )
289267 throw diagnostics . DF0050 ( { port : args . port } )
@@ -303,15 +281,6 @@ async function call(
303281 } )
304282}
305283
306- /** Select the agent-capable instance when several bases share one port. */
307- export function selectInstanceRecord (
308- records : readonly DevframeInstanceRecord [ ] ,
309- port : number ,
310- ) : DevframeInstanceRecord | undefined {
311- const matching = records . filter ( record => record . port === port )
312- return matching . find ( record => record . mcp ) ?? matching [ 0 ]
313- }
314-
315284async function withInstanceClient < T > (
316285 sdk : ConnectSdk ,
317286 url : string ,
0 commit comments