import"./index-DkVMZPZp.js";import{c as o}from"./constants-Chp3RuVB.js";function f(t){return t?t.find(n=>n.name.endsWith("_LIST"))?.name??"":""}function u(t){return t?t.find(n=>n.name.endsWith("_FILTERS"))?.name??"":""}function m(t){if(!t)return[];const e=[];for(const n of t){let r=[];if(Array.isArray(n))r=n;else if(typeof n=="object"&&n!==null){const i=Object.keys(n).find(a=>Array.isArray(n[a]));i&&(r=n[i])}e.push(...r)}return e}const c={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function y(t){return t?c[t]??t.toUpperCase():null}function T(t){return t?t.match(/schemas\/([\d-]+)/)?.[1]??null:null}function d(t){if(!t)return[];if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null){const e=Object.keys(t).find(n=>Array.isArray(t[n]));if(e)return t[e]}return[]}async function h(t,e,n,r){const i=await o({connectionId:t,orgId:e});try{const a=await i.callTool({name:n,arguments:r});return a.structuredContent??a}finally{await i.close().catch(console.error)}}export{m as a,u as b,T as c,h as d,d as e,f,y as g};
