import{findDefinitionByName as p}from"../utils.js";import{getEndpointsFromPaths as c}from"./utils.js";import{telemetry as r}from"../../../../telemetry/index.js";const e="get-endpoints",a={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"API name (or part of it)",minLength:1}}};function m(s,i){s.tool(e,"Get all endpoints for a specific API",a,async({name:o})=>{try{const t=p(i,o);if(!t)return{content:[{type:"text",text:`No APIs found matching "${o}"`}]};const n=c(t);return n.length===0?{content:[{type:"text",text:"No endpoints found"}]}:(r.sendMcpToolCalledMessage({server_type:"docs",tool:e}),{content:[{type:"text",text:JSON.stringify({api:t.info?.title||"",version:t.info?.version||"",servers:t.servers||[],endpoints:n},null,2)}]})}catch(t){throw r.sendMcpErrorMessage({server_type:"docs",tool:e,message:t?.message||"",stack:t?.stack||""}),t}})}export{m as registerGetEndpointsTools};
