@redocly/redoc-revel 0.138.0 → 0.139.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/client/app/markdoc/custom-components/openapi/openapi-example.js +1 -1
  3. package/dist/client/templates/api-docs/template.js +8 -8
  4. package/dist/constants/l10n/langs/ar.js +1 -1
  5. package/dist/constants/l10n/langs/de.js +1 -1
  6. package/dist/constants/l10n/langs/en.js +1 -1
  7. package/dist/constants/l10n/langs/es.js +1 -1
  8. package/dist/constants/l10n/langs/fr.js +1 -1
  9. package/dist/constants/l10n/langs/hi.js +1 -1
  10. package/dist/constants/l10n/langs/it.js +1 -1
  11. package/dist/constants/l10n/langs/ja.js +1 -1
  12. package/dist/constants/l10n/langs/ko.js +1 -1
  13. package/dist/constants/l10n/langs/pl.js +1 -1
  14. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  15. package/dist/constants/l10n/langs/pt.js +1 -1
  16. package/dist/constants/l10n/langs/ru.js +1 -1
  17. package/dist/constants/l10n/langs/uk.js +1 -1
  18. package/dist/constants/l10n/langs/zh.js +1 -1
  19. package/dist/server/plugins/api-docs/search/create-indexer.d.ts +9 -2
  20. package/dist/server/plugins/api-docs/search/create-indexer.js +1 -1
  21. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +68 -68
  22. package/dist/server/plugins/api-docs/search/search-resolver.js +1 -1
  23. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  24. package/dist/server/plugins/mcp/codemode/capabilities/utils.js +4 -4
  25. package/dist/server/plugins/mcp/codemode/constants.js +1 -1
  26. package/dist/server/plugins/mcp/codemode/prompts.d.ts +2 -1
  27. package/dist/server/plugins/mcp/codemode/prompts.js +8 -8
  28. package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +2 -2
  29. package/dist/server/plugins/mcp/codemode/tools/execute-schema.d.ts +2 -0
  30. package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
  31. package/dist/server/plugins/mcp/constants.d.ts +2 -0
  32. package/dist/server/plugins/mcp/constants.js +1 -1
  33. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  34. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -1
  35. package/dist/server/plugins/mcp/docs-mcp/tools/core/submit-feedback.js +2 -2
  36. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.d.ts +3 -2
  37. package/dist/server/plugins/mcp/gateway-mcp/callable-apis.js +1 -1
  38. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  39. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  40. package/dist/server/plugins/mcp/utils/docs-site-url.d.ts +6 -0
  41. package/dist/server/plugins/mcp/utils/docs-site-url.js +1 -0
  42. package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
  43. package/package.json +4 -4
@@ -1,5 +1,12 @@
1
1
  import { ApiDocsSearchIndexer } from '@redocly/api-docs';
2
- import type { ExampleEntry, SchemaEntry } from '@redocly/api-docs';
2
+ import type { ExampleEntry, GraphqlStoreMeta, SchemaEntry, SearchIndexerOptions } from '@redocly/api-docs';
3
+ import type { RenderTagFn } from '../../../../types/index.js';
4
+ export type DescriptionFormatter = NonNullable<SearchIndexerOptions['formatDescription']>;
5
+ /**
6
+ * Formats an API description (a string or a Markdoc AST) as Markdown for AI search documents and
7
+ * llms.txt. Tags render through `renderTag` (their `renderForLlms`).
8
+ */
9
+ export declare function createLlmDescriptionFormatter(renderTag?: RenderTagFn): DescriptionFormatter;
3
10
  /** The shared api-docs indexer with Markdown descriptions — AI search documents and llms.txt need Markdown. */
4
- export declare function createApiDocsSearchIndexer(basePath: string, schemaStore?: Record<string, SchemaEntry>, document?: Record<string, unknown>, exampleStore?: Record<string, ExampleEntry>): ApiDocsSearchIndexer;
11
+ export declare function createApiDocsSearchIndexer(basePath: string, formatDescription: DescriptionFormatter, schemaStore?: Record<string, SchemaEntry>, document?: Record<string, unknown>, exampleStore?: Record<string, ExampleEntry>, graphqlMeta?: GraphqlStoreMeta): ApiDocsSearchIndexer;
5
12
  //# sourceMappingURL=create-indexer.d.ts.map
@@ -1 +1 @@
1
- import{ApiDocsSearchIndexer as e}from"@redocly/api-docs";import{toMarkdown as i}from"../../markdown/search/to-markdown.js";function a(r){if(typeof r=="string")return r;const t=Array.isArray(r)?r:[r];return i(t).trim()}function f(r,t,o,n){return new e(r,t,o,{formatDescription:a,exampleStore:n})}export{f as createApiDocsSearchIndexer};
1
+ import{ApiDocsSearchIndexer as a,markdocParser as f,parseMarkdown as p}from"@redocly/api-docs";import{toMarkdown as s}from"../../markdown/search/to-markdown.js";function u(i){const n=new Map;return r=>{if(typeof r=="string"&&!r.includes("{%"))return r;const e=typeof r=="string"?n.get(r):void 0;if(e!==void 0)return e;const t=p(r,{markdownParser:f}),o=!t||typeof t=="string"?t??"":s(Array.isArray(t)?t:[t],{renderTag:i}).trim();return typeof r=="string"&&n.set(r,o),o}}function d(i,n,r,e,t,o){return new a(i,r,e,{formatDescription:n,exampleStore:t,graphqlMeta:o})}export{d as createApiDocsSearchIndexer,u as createLlmDescriptionFormatter};
@@ -1,105 +1,105 @@
1
- import P from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{nodeTypes as h,contentType as y}from"@redocly/api-docs";import{normalizeApiVersion as sn}from"../utils/normalize-api-version.js";import{replaceFileExtension as U}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as cn,canDownloadApiDefinition as ln,extractTeamsFromScopeItems as fn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as J}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Q}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as an}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as pn}from"../../../constants/rbac.js";import{toMarkdown as v}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as un}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as dn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as hn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as N}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as mn}from"../../search/utils.js";import{extractDocumentSearchFacets as $n}from"./search-facets.js";import{createApiDocsSearchIndexer as yn}from"./create-indexer.js";function A(t,o){return o==="openapi"&&"openapi"in t}function H(t,o){return o==="asyncapi"&&"asyncapi"in t}function Qn({items:t,metadata:o,store:s,document:n,specType:r,excludeFromSearch:i,basePath:e,getSearchFacets:l,markdocTags:c}){return async(f,a,u,d)=>{if(i)return;const m={...d.markdocOptions?.tags,...c},{locale:X,translate:Z}=await hn(f.slug,d.getGlobalData?.().l10n),x=un(m,X,Z),C=d.getConfig(),L=dn(f.fsPath),j=yn(e,s?.schemaStore,n,s?.exampleStore),M=g=>{for(const p of g)j.addItem(p),p.items?.length&&M(p.items)};M(t);const nn=j.getResult(),V=new Map;for(const g of nn)V.set(g.url,g);const R=typeof o.title=="string"?o.title:void 0,_=sn(o.version),D=$n(f.metadata||{},R,_,l),S=[],I=[],q=gn(o,n,r),F=bn(r,o,f.fsPath,C),tn=In(t,C,x),en=q+F+`
2
- `+tn,on=q+F;I.push({title:R||"API Overview",description:typeof o.description=="string"?o.description:void 0,content:en,slug:e,fsPath:f.fsPath,includeInLLMsTxt:!0}),S.push({title:R||"API Overview",content:on,url:e,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D});const rn=n&&A(n,r)?n.security:void 0,E=g=>{for(const p of g){if(!p.content||!p.link){p.items?.length&&E(p.items);continue}const k=V.get(p.link),G=p.content.contentType,z=p[O],W=z?fn(z):void 0,B=W?.length?W:void 0;if(G===y.ITEM){const $=Pn(p,n,r)??Y(p,k,r,_,rn,x);if($){const b=p.label||"";I.push({title:b,description:void 0,content:$,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}else if(G===y.GROUP){const $=On(p,C,r,x);if($){const b=p.label||"";I.push({title:b,description:k?Rn(k.text):void 0,content:$.llmstxt,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$.aiSearch,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}p.items?.length&&E(p.items)}};return E(t),{async getLLMsTxts(){return I},async getSearchDocuments(){return S}}}}function gn(t,o,s){const n=typeof t.title=="string"?t.title:"",r=typeof t.description=="string"?t.description:"",i=typeof t.summary=="string"?t.summary:"",e=typeof t.version=="string"?t.version:"";let l=n?`# ${n}
1
+ import T from"node:path";import{REDOCLY_TEAMS_RBAC as C}from"@redocly/config";import{nodeTypes as m,contentType as g,isGraphqlFieldsNode as ln,resolveGraphqlItemFields as fn}from"@redocly/api-docs";import{normalizeApiVersion as an}from"../utils/normalize-api-version.js";import{replaceFileExtension as v}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as pn,canDownloadApiDefinition as un,extractTeamsFromScopeItems as dn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as H}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Y}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as hn}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as mn}from"../../../constants/rbac.js";import{toMarkdown as N}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as $n}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as yn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as gn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as w}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as bn}from"../../search/utils.js";import{extractDocumentSearchFacets as In}from"./search-facets.js";import{createApiDocsSearchIndexer as Pn,createLlmDescriptionFormatter as Sn}from"./create-indexer.js";function P(t,r){return r==="openapi"&&"openapi"in t}function K(t,r){return r==="asyncapi"&&"asyncapi"in t}function Xn({items:t,metadata:r,store:l,document:o,specType:n,excludeFromSearch:e,basePath:i,getSearchFacets:c,markdocTags:f}){return async(s,d,p,u)=>{if(e)return;const h={...u.markdocOptions?.tags,...f},{locale:$,translate:nn}=await gn(s.slug,u.getGlobalData?.().l10n),S=$n(h,$,nn),L=u.getConfig(),R=yn(s.fsPath),D=Sn(S),j=Pn(i,D,l?.schemaStore,o,l?.exampleStore,l?.graphqlMeta),V=b=>{for(const a of b)j.addItem(a),a.items?.length&&V(a.items)};V(t);const tn=j.getResult(),F=new Map;for(const b of tn)F.set(b.url,b);const E=typeof r.title=="string"?r.title:void 0,_=an(r.version),k=In(s.metadata||{},E,_,c),A=[],O=[],q=typeof r.description=="string"&&r.description?D(r.description):void 0,G=An(r,q,o,n,D),z=On(n,r,s.fsPath,L),en=xn(t,L,S),on=G+z+`
2
+ `+en,sn=G+z;O.push({title:E||"API Overview",description:q,content:on,slug:i,fsPath:s.fsPath,includeInLLMsTxt:!0}),A.push({title:E||"API Overview",content:sn,url:i,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k});const rn=o&&P(o,n)?o.security:void 0,U=b=>{for(const a of b){if(!a.content||!a.link){a.items?.length&&U(a.items);continue}const cn=F.get(a.link),W=a.content.contentType,B=a[C],J=B?dn(B):void 0,Q=J?.length?J:void 0;if(W===g.ITEM){const y=Ln(a,o,n)??X(a,cn,n,_,rn,S,l);if(y){const I=a.label||"";O.push({title:I,description:void 0,content:y,slug:a.link,fsPath:s.fsPath,includeInLLMsTxt:!1}),A.push({title:I,content:y,url:a.link,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k,rbacTeams:Q})}}else if(W===g.GROUP){const y=Rn(a,L,n,S,l);if(y){const I=a.label||"";O.push({title:I,description:void 0,content:y.llmstxt,slug:a.link,fsPath:s.fsPath,includeInLLMsTxt:!1}),A.push({title:I,content:y.aiSearch,url:a.link,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k,rbacTeams:Q})}}a.items?.length&&U(a.items)}};return U(t),{async getLLMsTxts(){return O},async getSearchDocuments(){return A}}}}function An(t,r,l,o,n){const e=typeof t.title=="string"?t.title:"",i=typeof t.summary=="string"?t.summary:"",c=typeof t.version=="string"?t.version:"";let f=e?`# ${e}
3
3
 
4
- `:"";if(l+=r?`${r}
4
+ `:"";if(f+=r?`${r}
5
5
 
6
- `:"",l+=i?`${i}
6
+ `:"",f+=i?`${i}
7
7
 
8
- `:"",l+=e?`Version: ${e}
9
- `:"",o){if(A(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
10
- `);const f=c["x-metadata"],a=mn(f);a&&(l+=`
8
+ `:"",f+=c?`Version: ${c}
9
+ `:"",l){if(P(l,o)){const{info:s}=l;s?.license?.name&&(f+=`License: ${s.license.name}
10
+ `);const d=s["x-metadata"],p=bn(d);p&&(f+=`
11
11
  Metadata:
12
- ${a}
13
- `)}else if(H(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
14
- `)}}return l+=`
15
- `,l+=An(o,s),l+=Sn(o,s),l}function bn(t,o,s,n){if(!s)return"";let r,i,e;if(t==="openapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download OpenAPI description",e="OpenAPI definition";else if(t==="asyncapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download AsyncAPI description",e="AsyncAPI definition";else if(t==="graphql"){const f=P.posix.extname(s)||".graphql";r=P.posix.join(an,U(s,f)),i="## Download GraphQL schema",e="GraphQL schema"}else return"";if(!ln(r,n.access?.rbac??{},n.access?.requiresLogin??!1,pn))return"";const c=typeof o.title=="string"&&o.title||e;return`${i}
12
+ ${p}
13
+ `)}else if(K(l,o)){const{info:s}=l;s?.license?.name&&(f+=`License: ${s.license.name}
14
+ `)}}return f+=`
15
+ `,f+=Tn(l,o,n),f+=Cn(l,o,n),f}function On(t,r,l,o){if(!l)return"";let n,e,i;if(t==="openapi")n=T.posix.join(Y,v(l,".yaml")),e="## Download OpenAPI description",i="OpenAPI definition";else if(t==="asyncapi")n=T.posix.join(Y,v(l,".yaml")),e="## Download AsyncAPI description",i="AsyncAPI definition";else if(t==="graphql"){const s=T.posix.extname(l)||".graphql";n=T.posix.join(hn,v(l,s)),e="## Download GraphQL schema",i="GraphQL schema"}else return"";if(!un(n,o.access?.rbac??{},o.access?.requiresLogin??!1,mn))return"";const f=typeof r.title=="string"&&r.title||i;return`${e}
16
16
 
17
- - ${N({title:c,description:void 0,slug:r,siteUrl:n.seo?.siteUrl})}`}function An(t,o){if(!t)return"";if(A(t,o)){const{servers:s}=t;if(!s?.length)return"";let n=`## Servers
17
+ - ${w({title:f,description:void 0,slug:n,siteUrl:o.seo?.siteUrl})}`}function Tn(t,r,l){if(!t)return"";if(P(t,r)){const{servers:o}=t;if(!o?.length)return"";let n=`## Servers
18
18
 
19
- `;for(const r of s)if(r.description&&(n+=`${r.description}
19
+ `;for(const e of o)if(e.description&&(n+=`${l(e.description)}
20
20
  `),n+=`\`\`\`
21
- ${r.url}
21
+ ${e.url}
22
22
  \`\`\`
23
23
 
24
- `,r.variables){n+=`Variables:
25
- `;for(const[i,e]of Object.entries(r.variables))n+=`- \`${i}\`${e.description?`: ${e.description}`:""}
26
- `,e.default&&(n+=` Default: ${JSON.stringify(e.default)}
27
- `),e.enum&&(n+=` Enum: ${e.enum.map(l=>JSON.stringify(l)).join(", ")}
24
+ `,e.variables){n+=`Variables:
25
+ `;for(const[i,c]of Object.entries(e.variables))n+=`- \`${i}\`${c.description?`: ${l(c.description).replace(/\s+/g," ")}`:""}
26
+ `,c.default&&(n+=` Default: ${JSON.stringify(c.default)}
27
+ `),c.enum&&(n+=` Enum: ${c.enum.map(f=>JSON.stringify(f)).join(", ")}
28
28
  `);n+=`
29
- `}return n}if(H(t,o)){const{servers:s}=t;if(!s||!Object.keys(s).length)return"";let n=`## Servers
29
+ `}return n}if(K(t,r)){const{servers:o}=t;if(!o||!Object.keys(o).length)return"";let n=`## Servers
30
30
 
31
- `;for(const[r,i]of Object.entries(s))n+=`### ${r}
31
+ `;for(const[e,i]of Object.entries(o))n+=`### ${e}
32
32
 
33
- `,i.description&&(n+=`${i.description}
33
+ `,i.description&&(n+=`${l(i.description)}
34
34
  `),i.host&&(n+=`Host: ${i.host}
35
35
  `),i.protocol&&(n+=`Protocol: ${i.protocol}
36
36
  `),i.protocolVersion&&(n+=`Protocol Version: ${i.protocolVersion}
37
37
  `),i.pathname&&(n+=`Pathname: ${i.pathname}
38
38
  `),n+=`
39
- `;return n}return""}function Sn(t,o){if(!t||!A(t,o))return"";const s=t.components?.securitySchemes;if(!s)return"";let n=`## Security
40
-
41
- `;for(const[r,i]of Object.entries(s)){if(!i||"$ref"in i)continue;const e=i;n+=`### ${r}
42
-
43
- `,e.description&&(n+=`${e.description}
44
-
45
- `),e.type&&(n+=`Type: ${e.type}
46
- `),e.in&&(n+=`In: ${e.in}
47
- `),e.name&&(n+=`Name: ${e.name}
48
- `),e.scheme&&(n+=`Scheme: ${e.scheme}
49
- `),e.bearerFormat&&(n+=`Bearer Format: ${e.bearerFormat}
50
- `),e.openIdConnectUrl&&(n+=`OpenID Connect URL: ${e.openIdConnectUrl}
51
- `);const l=e.flows,c=l?.implicit||l?.password||l?.clientCredentials||l?.authorizationCode;if(c&&("authorizationUrl"in c&&c.authorizationUrl&&(n+=`Authorization URL: ${c.authorizationUrl}
52
- `),"tokenUrl"in c&&c.tokenUrl&&(n+=`Token URL: ${c.tokenUrl}
53
- `),c.scopes)){n+=`Scopes:
54
- `;for(const[f,a]of Object.entries(c.scopes))n+=`- \`${f}\`: ${a}
39
+ `;return n}return""}function Cn(t,r,l){if(!t||!P(t,r))return"";const o=t.components?.securitySchemes;if(!o)return"";let n=`## Security
40
+
41
+ `;for(const[e,i]of Object.entries(o)){if(!i||"$ref"in i)continue;const c=i;n+=`### ${e}
42
+
43
+ `,c.description&&(n+=`${l(c.description)}
44
+
45
+ `),c.type&&(n+=`Type: ${c.type}
46
+ `),c.in&&(n+=`In: ${c.in}
47
+ `),c.name&&(n+=`Name: ${c.name}
48
+ `),c.scheme&&(n+=`Scheme: ${c.scheme}
49
+ `),c.bearerFormat&&(n+=`Bearer Format: ${c.bearerFormat}
50
+ `),c.openIdConnectUrl&&(n+=`OpenID Connect URL: ${c.openIdConnectUrl}
51
+ `);const f=c.flows,s=f?.implicit||f?.password||f?.clientCredentials||f?.authorizationCode;if(s&&("authorizationUrl"in s&&s.authorizationUrl&&(n+=`Authorization URL: ${s.authorizationUrl}
52
+ `),"tokenUrl"in s&&s.tokenUrl&&(n+=`Token URL: ${s.tokenUrl}
53
+ `),s.scopes)){n+=`Scopes:
54
+ `;for(const[d,p]of Object.entries(s.scopes))n+=`- \`${d}\`: ${p}
55
55
  `}n+=`
56
- `}return n}function In(t,o,s){let n="";const r=(i,e)=>{for(const l of i)if(l.link){if(l.content?.contentType===y.GROUP)n+=`${e} ${l.label||""}
56
+ `}return n}function xn(t,r,l){let o="";const n=(e,i)=>{for(const c of e)if(c.link){if(c.content?.contentType===g.GROUP)o+=`${i} ${c.label||""}
57
57
 
58
- `,l.items?.length&&r(l.items,e+"#");else if(l.content?.contentType===y.ITEM){if(!w(l,o))continue;const c=l,f=c.httpVerb,a=c.httpPath,u=f&&a?`${f.toUpperCase()} ${a}`:l.label||"",d=l.content?T(l.content.children,s):void 0;n+=` - ${N({title:u,description:d?d.slice(0,200):void 0,slug:J(l.link),siteUrl:o.seo?.siteUrl})}`}}};return r(t,"##"),n}function Y(t,o,s,n,r,i){if(!t.content)return;const e=t,l=t.label||"",c=T(t.content.children,i),f=t.content.meta?.deprecated;let a=`# ${l}${f?" (deprecated)":""}
58
+ `,c.items?.length&&n(c.items,i+"#");else if(c.content?.contentType===g.ITEM){if(!M(c,r))continue;const f=c,s=f.httpVerb,d=f.httpPath,p=s&&d?`${s.toUpperCase()} ${d}`:c.label||"",u=c.content?x(c.content.children,l):void 0;o+=` - ${w({title:p,description:u?u.slice(0,200):void 0,slug:H(c.link),siteUrl:r.seo?.siteUrl})}`}}};return n(t,"##"),o}function X(t,r,l,o,n,e,i){if(!t.content)return;const c=t,f=t.label||"",s=x(t.content.children,e),d=t.content.meta?.deprecated;let p=`# ${f}${d?" (deprecated)":""}
59
59
 
60
- `;if(c&&(a+=`${c}
60
+ `;if(s&&(p+=`${s}
61
61
 
62
- `),s==="openapi"||s==="asyncapi"){const u=e.httpVerb,d=e.httpPath;u&&d?a+=`Endpoint: ${u.toUpperCase()} ${d}
63
- `:u&&(a+=`Method: ${u.toUpperCase()}
64
- `),n&&(a+=`Version: ${n}
65
- `);const m=Tn(t.content.children,r);m&&(a+=`Security: ${m}
66
- `)}return o?.parameters?.length&&s!=="graphql"&&(a+=`
67
- `+xn(o.parameters)+`
68
- `),s==="graphql"&&(a+=Cn(t.content.children)),a}function Pn(t,o,s){if(t.httpVerb!=="tool"||!o||!A(o,s))return;const n=t.content?.meta?.name,r=n?o["x-mcp"]?.tools?.find(e=>e.name===n):void 0;if(!r)return;let i=`# ${t.label||r.name}
62
+ `),l==="openapi"||l==="asyncapi"){const u=c.httpVerb,h=c.httpPath;u&&h?p+=`Endpoint: ${u.toUpperCase()} ${h}
63
+ `:u&&(p+=`Method: ${u.toUpperCase()}
64
+ `),o&&(p+=`Version: ${o}
65
+ `);const $=Dn(t.content.children,n);$&&(p+=`Security: ${$}
66
+ `)}return r?.parameters?.length&&l!=="graphql"&&(p+=`
67
+ `+En(r.parameters)+`
68
+ `),l==="graphql"&&(p+=kn(t.content.children,i)),p}function Ln(t,r,l){if(t.httpVerb!=="tool"||!r||!P(r,l))return;const o=t.content?.meta?.name,n=o?r["x-mcp"]?.tools?.find(i=>i.name===o):void 0;if(!n)return;let e=`# ${t.label||n.name}
69
69
 
70
- `;return typeof r.description=="string"&&r.description&&(i+=`${r.description}
70
+ `;return typeof n.description=="string"&&n.description&&(e+=`${n.description}
71
71
 
72
- `),i+=`## Input schema:
72
+ `),e+=`## Input schema:
73
73
 
74
- `,i+=`\`\`\`json
75
- ${JSON.stringify(r.inputSchema,null,2)}
74
+ `,e+=`\`\`\`json
75
+ ${JSON.stringify(n.inputSchema,null,2)}
76
76
  \`\`\`
77
77
 
78
- `,r.outputSchema&&(i+=`## Output schema:
78
+ `,n.outputSchema&&(e+=`## Output schema:
79
79
 
80
- `,i+=`\`\`\`json
81
- ${JSON.stringify(r.outputSchema,null,2)}
80
+ `,e+=`\`\`\`json
81
+ ${JSON.stringify(n.outputSchema,null,2)}
82
82
  \`\`\`
83
83
 
84
- `),i}function On(t,o,s,n){if(!t.content)return;const r=t.label||"",i=T(t.content.children,n);let e=`# ${r}
84
+ `),e}function Rn(t,r,l,o,n){if(!t.content)return;const e=t.label||"",i=x(t.content.children,o);let c=`# ${e}
85
85
 
86
- `;if(i&&(e+=`${i}
86
+ `;if(i&&(c+=`${i}
87
87
 
88
- `),s==="graphql"){let c="";const f=a=>{for(const u of a??[])if(!(!u.content||!w(u,o)))if(u.content.contentType===y.ITEM){const d=Y(u,void 0,s,void 0,void 0,n);d&&(c+=`${d}
88
+ `),l==="graphql"){let s="";const d=p=>{for(const u of p??[])if(!(!u.content||!M(u,r)))if(u.content.contentType===g.ITEM){const h=X(u,void 0,l,void 0,void 0,o,n);h&&(s+=`${h}
89
89
 
90
90
  ---
91
91
 
92
- `)}else u.content.contentType===y.GROUP&&f(u.items)};return f(t.items),{llmstxt:e+c,aiSearch:e}}let l="";if(t.items?.length)for(const c of t.items){if(!c.link||!c.content||c.content.contentType!==y.ITEM||!w(c,o))continue;const f=c,a=f.httpVerb,u=f.httpPath,d=a&&u?`${a.toUpperCase()} ${u}`:c.label||"",m=c.content?T(c.content.children,n):void 0;l+=` - ${N({title:d,description:m?m.slice(0,200):void 0,slug:J(c.link),siteUrl:o.seo?.siteUrl})}`}return{llmstxt:e+l,aiSearch:e}}function Tn(t,o){const s=[],n=r=>{for(const i of r)if(i.nodeType===h.SECURITY){const e=i;for(const l of e.requirements)for(const c of l.schemes)c[O]||c.name&&!s.includes(c.name)&&s.push(c.name)}else(i.nodeType===h.CONTAINER||i.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(i.children)};if(n(t),s.length)return s.join(", ");if(o?.length){const r=o.flatMap(i=>Object.keys(i));if(r.length)return[...new Set(r)].join(", ")}}function xn(t){const o={};for(const n of t){const r=`${n.place}${n.mediaType?` (${n.mediaType})`:""}`;o[r]||(o[r]=[]),o[r].push(n)}return Object.entries(o).map(([n,r])=>{const i=r.map(e=>{const l=[...e.path||[],e.name],c=Array.isArray(e.description)?e.description.join(" "):e.description;let f=` - \`${l.join(".")}\` (${e.type}${e.required?", required":""})
93
- `;return c&&(f+=` ${c.trim()}
94
- `),e.enum?f+=` Enum: ${e.enum.map(a=>JSON.stringify(a)).join(", ")}
95
- `:e.example&&(f+=` Example: ${e.example}
96
- `),f});return`## ${K(n)}:
92
+ `)}else u.content.contentType===g.GROUP&&d(u.items)};return d(t.items),{llmstxt:c+s,aiSearch:c}}let f="";if(t.items?.length)for(const s of t.items){if(!s.link||!s.content||s.content.contentType!==g.ITEM||!M(s,r))continue;const d=s,p=d.httpVerb,u=d.httpPath,h=p&&u?`${p.toUpperCase()} ${u}`:s.label||"",$=s.content?x(s.content.children,o):void 0;f+=` - ${w({title:h,description:$?$.slice(0,200):void 0,slug:H(s.link),siteUrl:r.seo?.siteUrl})}`}return{llmstxt:c+f,aiSearch:c}}function Dn(t,r){const l=[],o=n=>{for(const e of n)if(e.nodeType===m.SECURITY){const i=e;for(const c of i.requirements)for(const f of c.schemes)f[C]||f.name&&!l.includes(f.name)&&l.push(f.name)}else(e.nodeType===m.CONTAINER||e.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(e.children)};if(o(t),l.length)return l.join(", ");if(r?.length){const n=r.flatMap(e=>Object.keys(e));if(n.length)return[...new Set(n)].join(", ")}}function En(t){const r={};for(const o of t){const n=`${o.place}${o.mediaType?` (${o.mediaType})`:""}`;r[n]||(r[n]=[]),r[n].push(o)}return Object.entries(r).map(([o,n])=>{const e=n.map(i=>{const c=[...i.path||[],i.name],f=Array.isArray(i.description)?i.description.join(" "):i.description;let s=` - \`${c.join(".")}\` (${i.type}${i.required?", required":""})
93
+ `;return f&&(s+=` ${f.trim()}
94
+ `),i.enum?s+=` Enum: ${i.enum.map(d=>JSON.stringify(d)).join(", ")}
95
+ `:i.example&&(s+=` Example: ${i.example}
96
+ `),s});return`## ${Z(o)}:
97
97
 
98
- ${i.join(`
98
+ ${e.join(`
99
99
  `)}`}).join(`
100
- `)}function Cn(t){let o="";const s=n=>{for(const r of n)if(r.nodeType===h.ITEM){const i=r;i.graphqlSchema&&(o+=Ln(i.graphqlSchema,i.variant))}else(r.nodeType===h.CONTAINER||r.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&s(r.children)};return s(t),o}function Ln(t,o){let n=`
101
- ## ${K(o==="return-type"?"Return type":o==="graphql-args"||o==="arguments"?"Arguments":o==="graphql-fields"?"Fields":o)}:
100
+ `)}function kn(t,r){let l="";const o=n=>{for(const e of n)if(e.nodeType===m.ITEM){const i=ln(e)?fn(e,r??{}):void 0;i&&(l+=Un(i,e.variant))}else(e.nodeType===m.CONTAINER||e.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(e.children)};return o(t),l}function Un(t,r){let o=`
101
+ ## ${Z(r==="return-type"?"Return type":r==="graphql-args"||r==="arguments"?"Arguments":r==="graphql-fields"?"Fields":r)}:
102
102
 
103
- `;const r=i=>{const e=i.description?v(Array.isArray(i.description)?i.description:[i.description]).trim():"";return` - \`${i.name}\` (${i.type})${e?`: ${e}`:""}
104
- `};if(!Array.isArray(t)){const i=t.description?v(Array.isArray(t.description)?t.description:[t.description]).trim():"";n+=` Type: ${t.type}`,i&&(n+=` - ${i}`),n+=`
105
- `;for(const e of t.fields??[])n+=r(e);return n}if(!t.length)return"";for(const i of t)n+=r(i);return n}function T(t,o){const s=[],n=i=>{for(const e of i)if(e.nodeType===h.MARKDOC){const l=e.content,c=Array.isArray(l)?l:[l],f=v(c,{renderTag:o}).trim();f&&s.push(f)}else(e.nodeType===h.CONTAINER||e.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(e.children)};return n(t),s.join(" ").trim()||void 0}function Rn(t){return(Array.isArray(t)?t.join(" "):t)||void 0}function K(t){return t.charAt(0).toUpperCase()+t.slice(1)}function w(t,o){return o.access?.requiresLogin?!0:cn({slug:t.link||"",[O]:t[O]},o)}export{Qn as getAiDocumentsStore};
103
+ `;const n=e=>{const i=e.description?N(Array.isArray(e.description)?e.description:[e.description]).trim():"";return` - \`${e.name}\` (${e.type.display})${i?`: ${i}`:""}
104
+ `};if(t.type){const e=t.type.description?N(Array.isArray(t.type.description)?t.type.description:[t.type.description]).trim():"";o+=` Type: ${t.type.display}`,e&&(o+=` - ${e}`),o+=`
105
+ `}else if(!t.fields.length)return"";for(const e of t.fields)o+=n(e);return o}function x(t,r){const l=[],o=e=>{for(const i of e)if(i.nodeType===m.MARKDOC){const c=i.content,f=Array.isArray(c)?c:[c],s=N(f,{renderTag:r}).trim();s&&l.push(s)}else(i.nodeType===m.CONTAINER||i.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(i.children)};return o(t),l.join(" ").trim()||void 0}function Z(t){return t.charAt(0).toUpperCase()+t.slice(1)}function M(t,r){return r.access?.requiresLogin?!0:pn({slug:t.link||"",[C]:t[C]},r)}export{Xn as getAiDocumentsStore};
@@ -1 +1 @@
1
- import{REDOCLY_ROUTE_RBAC as h,REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{extractDocumentSearchFacets as x,setDocumentSearchFacets as A}from"./search-facets.js";import{ApiDocsSearchIndexer as D}from"@redocly/api-docs";import{normalizeApiVersion as d}from"../utils/normalize-api-version.js";function O(u,i,c,S,R,a,g){return async e=>{if(R)return[];const m=e.baseSlug||e.slug,l=new D(m,a?.schemaStore,g,{exampleStore:a?.exampleStore}),f=t=>{for(const r of t)l.addItem(r),r.items?.length&&f(r.items)};f(u);const s=typeof i.title=="string"?i.title:void 0,n=d(i.version),p=x(e.metadata||{},s,n,c);return A(p,c,S),l.getResult().map(t=>({...t,...t.url===m&&s&&{title:n?`${s} (${n})`:s},[o]:t[o]??e[o],[h]:e[h]??{slug:e.slug,fsPath:e.fsPath},facets:p}))}}export{O as searchResolver};
1
+ import{REDOCLY_ROUTE_RBAC as h,REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{extractDocumentSearchFacets as x,setDocumentSearchFacets as A}from"./search-facets.js";import{ApiDocsSearchIndexer as D}from"@redocly/api-docs";import{normalizeApiVersion as d}from"../utils/normalize-api-version.js";function M(g,i,c,u,S,n,R){return async e=>{if(S)return[];const m=e.baseSlug||e.slug,l=new D(m,n?.schemaStore,R,{exampleStore:n?.exampleStore,graphqlMeta:n?.graphqlMeta}),p=t=>{for(const a of t)l.addItem(a),a.items?.length&&p(a.items)};p(g);const s=typeof i.title=="string"?i.title:void 0,r=d(i.version),f=x(e.metadata||{},s,r,c);return A(f,c,u),l.getResult().map(t=>({...t,...t.url===m&&s&&{title:r?`${s} (${r})`:s},[o]:t[o]??e[o],[h]:e[h]??{slug:e.slug,fsPath:e.fsPath},facets:f}))}}export{M as searchResolver};
@@ -1 +1 @@
1
- import w from"path";import{lintConfig as A,loadConfig as T,createConfigTypes as U}from"@redocly/openapi-core";import{deepMerge as $}from"../../../../../utils/object/deep-merge.js";import{logger as d}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as L}from"../../../../../constants/common.js";import{sanitizeBranchName as x}from"../../../../utils/envs/sanitize-branch-name.js";import{envConfig as C}from"../../../../config/env-config.js";import{safeParsePartial as E}from"../../safe-parse.js";import{formatConfigProblem as B}from"../../format-error.js";import{ExternalResolver as j}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as q}from"../../resolve-mutual-exclusion.js";function h(e,t,s,o){t in e&&e[t]&&typeof e[t]=="string"&&(/^https?:\/\/.*/.test(e[t])||o(new Error(`Invalid ${s} URL: "${e[t]}". ${s} must start with "http://" or "https://".`)))}function N(e,t){if("access"in e&&e.access&&typeof e.access=="object"){const s=e.access;h(s,"logoutReturnUrl","access.logoutReturnUrl",t),h(s,"residency","access.residency",t);const o=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const a of o)a in s&&s[a]!==void 0&&a in e&&e[a]!==void 0&&t(new Error(`Property '${a}' is defined both at root level and in 'access' object. Please use 'access.${a}' to define this configuration.`))}}async function J(e,t,s,o){const p=t.getFileInfo(e)?.realRelativePath||e;async function i(){const l=new j(t),u=w.join(t.cwd,p),c=await T({configPath:u,externalRefResolver:l}),f=await o(c.resolvedConfig);if(f===void 0)return c.resolvedConfig;const m=c.document?.source,P=[...m?await A({config:c,externalConfigTypes:U(f,c)}):[],...m?q(c.resolvedConfig,m):[]];if(P.length>0)for(const b of P)s(new Error(B(b,t.cwd)));return c.resolvedConfig}const r=await t.exists(e)?await i():{},R=k(r),v=await o(r);h(r,"residency","Residency",s),h(r,"logoutReturnUrl","Logout return URL",s),N(r,s);let g=v?E(v,r):r;const{env:y}=g;if(y){const l=C.REDOCLY_ENV,u=y[l]||{},c=C.PUBLIC_REDOCLY_BRANCH_NAME||"",f=c?x(c):"",m=f&&y[`${L}${f}`]||{};g=$(g,m,u)}const n=I(g,R);if(n.imports&&n.imports.length>0){d.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const l=new Set([...n.plugins||[],...n.imports.map(u=>w.posix.join(u,"plugin.js"))]);n.plugins=Array.from(l),delete n.imports}if(n.catalog&&(d.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),n.catalogClassic={...n.catalog},delete n.catalog),n.scorecard&&(d.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),n.scorecardClassic=n.scorecard,delete n.scorecard),n.search?.ai){d.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const l={...n.search?.ai,...n.aiAssistant,suggestions:n.aiAssistant?.suggestions?.length?n.aiAssistant.suggestions:n.search?.ai.suggestions||[]};n.aiAssistant=l,delete n.search.ai}return _(n)}function _(e){const t={...e},o={..."access"in e&&e.access&&typeof e.access=="object"?e.access:{}},a=["requiresLogin","logoutReturnUrl","residency","sso","idps","rbac"],p=[];for(const i of a){const r=t[i];r!==void 0&&(p.push(i),i==="requiresLogin"&&o.requiresLogin===void 0&&(o.requiresLogin=r),i==="logoutReturnUrl"&&o.logoutReturnUrl===void 0&&(o.logoutReturnUrl=r),i==="residency"&&o.residency===void 0&&(o.residency=r),i==="sso"&&o.sso===void 0&&(o.sso=r),i==="idps"&&o.idps===void 0&&(o.idps=r),i==="rbac"&&o.rbac===void 0&&(o.rbac=r),delete t[i])}return p.length>0&&d.warn(`The following properties at root level are deprecated: ${p.join(", ")}. Please move them to the 'access' object.`),Object.keys(o).length>0&&(t.access=o),t}function k(e){if(!e.theme)return[];d.warn("The 'theme' property in redocly.yaml is deprecated. Please move all of the properties from 'theme' to the root of the config.");const t=[];for(const s of Object.keys(e.theme))e[s]==null?t.push(s):d.warn(`Detected both '${s}' and 'theme.${s}' properties in redocly.yaml. The 'theme.${s}' property will be ignored and needs to be removed or merged into the '${s}'.`);return t}function I(e,t){if(!e.theme||t.length===0)return e;const s={...e};for(const o of t)s[o]=e.theme[o];return delete s.theme,s}export{_ as ensureAccessBackwardsCompatibility,J as readAndValidateConfig};
1
+ import w from"path";import{lintConfig as $,loadConfig as T,createConfigTypes as q}from"@redocly/openapi-core";import{rootRedoclyConfigSchema as x}from"@redocly/config";import{deepMerge as L}from"../../../../../utils/object/deep-merge.js";import{isPlainObject as g}from"../../../../../utils/guards/is-plain-object.js";import{logger as d}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as j}from"../../../../../constants/common.js";import{sanitizeBranchName as E}from"../../../../utils/envs/sanitize-branch-name.js";import{envConfig as R}from"../../../../config/env-config.js";import{ajv as S,safeParsePartial as B}from"../../safe-parse.js";import{formatConfigProblem as I}from"../../format-error.js";import{ExternalResolver as N}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as O}from"../../resolve-mutual-exclusion.js";function y(e,t,r,s){t in e&&e[t]&&typeof e[t]=="string"&&(/^https?:\/\/.*/.test(e[t])||s(new Error(`Invalid ${r} URL: "${e[t]}". ${r} must start with "http://" or "https://".`)))}function _(e,t){if("access"in e&&e.access&&typeof e.access=="object"){const r=e.access;y(r,"logoutReturnUrl","access.logoutReturnUrl",t),y(r,"residency","access.residency",t);const s=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const i of s)i in r&&r[i]!==void 0&&i in e&&e[i]!==void 0&&t(new Error(`Property '${i}' is defined both at root level and in 'access' object. Please use 'access.${i}' to define this configuration.`))}}function k(e){return S.compile(x.properties.graphql.properties.servers.items.properties.url)(e)}function C(e,t,r){if(g(e)&&Array.isArray(e.servers))for(const s of e.servers){const i=g(s)?s.url:void 0;if(typeof i=="string"&&!k(i)){const l=e.servers.indexOf(s),a=`${t}.servers[${l}].url`;r(new Error(`Invalid ${a}: "${i}". It must be an absolute http:// or https:// URL.`))}}}function G(e,t){if(C(e.graphql,"graphql",t),!!g(e.apis))for(const[r,s]of Object.entries(e.apis))g(s)&&C(s.graphql,`apis.${r}.graphql`,t)}async function oe(e,t,r,s){const l=t.getFileInfo(e)?.realRelativePath||e;async function a(){const p=new N(t),u=w.join(t.cwd,l),c=await T({configPath:u,externalRefResolver:p}),f=await s(c.resolvedConfig);if(f===void 0)return c.resolvedConfig;const m=c.document?.source,b=[...m?await $({config:c,externalConfigTypes:q(f,c)}):[],...m?O(c.resolvedConfig,m):[]];if(b.length>0)for(const U of b)r(new Error(I(U,t.cwd)));return c.resolvedConfig}const n=t.exists(e)?await a():{},A=D(n),P=await s(n);y(n,"residency","Residency",r),y(n,"logoutReturnUrl","Logout return URL",r),_(n,r),G(n,r);let h=P?B(P,n):n;const{env:v}=h;if(v){const p=R.REDOCLY_ENV,u=v[p]||{},c=R.PUBLIC_REDOCLY_BRANCH_NAME||"",f=c?E(c):"",m=f&&v[`${j}${f}`]||{};h=L(h,m,u)}const o=z(h,A);if(o.imports&&o.imports.length>0){d.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const p=new Set([...o.plugins||[],...o.imports.map(u=>w.posix.join(u,"plugin.js"))]);o.plugins=Array.from(p),delete o.imports}if(o.catalog&&(d.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),o.catalogClassic={...o.catalog},delete o.catalog),o.scorecard&&(d.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),o.scorecardClassic=o.scorecard,delete o.scorecard),o.search?.ai){d.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const p={...o.search?.ai,...o.aiAssistant,suggestions:o.aiAssistant?.suggestions?.length?o.aiAssistant.suggestions:o.search?.ai.suggestions||[]};o.aiAssistant=p,delete o.search.ai}return M(o)}function M(e){const t={...e},s={..."access"in e&&e.access&&typeof e.access=="object"?e.access:{}},i=["requiresLogin","logoutReturnUrl","residency","sso","idps","rbac"],l=[];for(const a of i){const n=t[a];n!==void 0&&(l.push(a),a==="requiresLogin"&&s.requiresLogin===void 0&&(s.requiresLogin=n),a==="logoutReturnUrl"&&s.logoutReturnUrl===void 0&&(s.logoutReturnUrl=n),a==="residency"&&s.residency===void 0&&(s.residency=n),a==="sso"&&s.sso===void 0&&(s.sso=n),a==="idps"&&s.idps===void 0&&(s.idps=n),a==="rbac"&&s.rbac===void 0&&(s.rbac=n),delete t[a])}return l.length>0&&d.warn(`The following properties at root level are deprecated: ${l.join(", ")}. Please move them to the 'access' object.`),Object.keys(s).length>0&&(t.access=s),t}function D(e){if(!e.theme)return[];d.warn("The 'theme' property in redocly.yaml is deprecated. Please move all of the properties from 'theme' to the root of the config.");const t=[];for(const r of Object.keys(e.theme))e[r]==null?t.push(r):d.warn(`Detected both '${r}' and 'theme.${r}' properties in redocly.yaml. The 'theme.${r}' property will be ignored and needs to be removed or merged into the '${r}'.`);return t}function z(e,t){if(!e.theme||t.length===0)return e;const r={...e};for(const s of t)r[s]=e.theme[s];return delete r.theme,r}export{M as ensureAccessBackwardsCompatibility,oe as readAndValidateConfig};
@@ -1,7 +1,7 @@
1
- import{buildToolTypeDeclarations as p,sanitizeToolName as c}from"../build-tool-type-declarations.js";import{buildExecuteExample as a,EXECUTE_ARGS_NOTE as m,USAGE_NOTES as u}from"../prompts.js";import{FETCH_TOOL_NAME as l}from"../constants.js";import{ALL_CAPABILITIES as d}from"./registry.js";function H(n){return d.filter(o=>o.isActive(n))}function h(n,o,r){const i=[...n.map(({annotations:t})=>t??{}),...o.map(t=>t.annotations(r))],e=i.filter(t=>t.readOnlyHint!==!0);return{readOnlyHint:e.length===0,destructiveHint:e.some(t=>t.destructiveHint!==!1),idempotentHint:e.every(t=>t.idempotentHint===!0),openWorldHint:i.some(t=>t.openWorldHint!==!1)}}function O(n,o,r){const i=n.map(t=>c(t.name)),e=[];if(n.length>0){const t=p(n),s=t.includes("OpenApi")?`
1
+ import{buildToolTypeDeclarations as p,sanitizeToolName as c}from"../build-tool-type-declarations.js";import{buildExecuteExample as a,EXECUTE_ARGS_NOTE as m,USAGE_NOTES as u}from"../prompts.js";import{FETCH_TOOL_NAME as l}from"../constants.js";import{READ_ONLY_ANNOTATIONS as f}from"../../constants.js";import{ALL_CAPABILITIES as d}from"./registry.js";function N(o){return d.filter(i=>i.isActive(o))}function h(o,i,s){const r=[...o.map(({annotations:t})=>t??{}),...i.map(t=>t.annotations(s))],n=r.filter(t=>t.readOnlyHint!==!0),e=r.some(t=>t.openWorldHint!==!1);return n.length===0?{...f,openWorldHint:e}:{readOnlyHint:!1,destructiveHint:n.some(t=>t.destructiveHint!==!1),idempotentHint:n.every(t=>t.idempotentHint===!0),openWorldHint:e}}function _(o,i,s){const r=o.map(e=>c(e.name)),n=[];if(o.length>0){const e=p(o),t=e.includes("OpenApi")?`
2
2
 
3
- ${u}`:"";e.push(`## Sandbox tools
3
+ ${u}`:"";n.push(`## Sandbox tools
4
4
 
5
- ${t}${s}`)}e.push(m),n.length>0&&!o.some(t=>t.id===l)&&e.push(a(i));for(const t of o)e.push(t.renderSection(r,i));return e.join(`
5
+ ${e}${t}`)}n.push(m),o.length>0&&!i.some(e=>e.id===l)&&n.push(a(r));for(const e of i)n.push(e.renderSection(s,r));return n.join(`
6
6
 
7
- `)}export{h as composeExecuteAnnotations,H as getActiveCapabilities,O as renderDescribeToolsOutput};
7
+ `)}export{h as composeExecuteAnnotations,N as getActiveCapabilities,_ as renderDescribeToolsOutput};
@@ -1 +1 @@
1
- import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as _,MANAGE_API_CREDENTIALS_TOOL_NAME as E}from"../constants.js";const O="execute",t="describe-tools",e="fetch",A=new Set([O,t,_,E]),N="tools",T="__fetchBridge",L="fetch";export{A as CODE_MODE_TOOL_NAMES,t as DESCRIBE_TOOLS_TOOL_NAME,O as EXECUTE_TOOL_NAME,L as FETCH_BRIDGE_FUNCTION_NAME,T as FETCH_BRIDGE_GLOBAL_NAME,e as FETCH_TOOL_NAME,N as TOOLS_BRIDGE_GLOBAL_NAME};
1
+ import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as _,MANAGE_API_CREDENTIALS_TOOL_NAME as E,SUBMIT_FEEDBACK_TOOL_NAME as O}from"../constants.js";const t="execute",o="describe-tools",e="fetch",N=new Set([t,o,_,E,O]),T="tools",L="__fetchBridge",M="fetch";export{N as CODE_MODE_TOOL_NAMES,o as DESCRIBE_TOOLS_TOOL_NAME,t as EXECUTE_TOOL_NAME,M as FETCH_BRIDGE_FUNCTION_NAME,L as FETCH_BRIDGE_GLOBAL_NAME,e as FETCH_TOOL_NAME,T as TOOLS_BRIDGE_GLOBAL_NAME};
@@ -1,7 +1,8 @@
1
1
  import { type ToolListEntry } from './build-tool-list.js';
2
2
  export declare const DESCRIPTION_CHAR_LIMIT = 2048;
3
3
  export declare const EXECUTE_ARGS_NOTE = "Both `execute` arguments are required: `code` (the JavaScript to run; return a value to receive it) and `description` (a short human-readable summary of what the code does).";
4
- export declare function buildExecuteDescription(hasFetch: boolean, toolList?: ToolListEntry[]): string;
4
+ /** The first line names the docs at `docsUrl` when the prose with it fits `DESCRIPTION_CHAR_LIMIT`. */
5
+ export declare function buildExecuteDescription(hasFetch: boolean, toolList?: ToolListEntry[], docsUrl?: string): string;
5
6
  export declare const DESCRIBE_TOOLS_DESCRIPTION: string;
6
7
  export declare function buildCodeModeInstructions(hasFetch: boolean, toolList?: ToolListEntry[]): string;
7
8
  export declare function buildExecuteExample(toolNames: string[]): string;
@@ -1,8 +1,8 @@
1
- import{buildToolList as i}from"./build-tool-list.js";const r=2048,d="Both `execute` arguments are required: `code` (the JavaScript to run; return a value to receive it) and `description` (a short human-readable summary of what the code does).",n="Available tools (exact signatures come from `describe-tools`):";function a(e,t){if(t.length===0)return e;const o=r-e.length-n.length-3,s=i(t,o);return s?[e,"",n,s].join(`
2
- `):e}function h(e,t=[]){const o=["Run JavaScript in a sandbox against the documentation tools on the global `tools` object.",e?"The extra globals are `tools`, `fetch`, `URL`, `URLSearchParams`, and `FormData` - there is no `console`, `setTimeout`, `require`, or Node.js API; all other I/O goes through `tools`.":"The only extra global is `tools` - there is no `fetch`, `console`, `setTimeout`, `require`, or Node.js API; all I/O goes through `tools`.","","Workflow - minimize round-trips; one `describe-tools` call plus one `execute` call covers most requests:","1. Analyze the request and decide which sandbox tools it needs.","2. Call `describe-tools` with those names to get their exact TypeScript signatures - inputs, result shapes, and a worked example. NEVER call `execute` with guessed method names, parameter names, enum values, or result field names: read fields off the declared return types, not from assumptions.","3. Batch everything into a SINGLE script: chain tool calls, pass one call's output into the next, process results in plain JavaScript, and `return` only what the request needs."].join(`
3
- `);return a(o,t)}const p=["Get the exact TypeScript signatures of the sandbox tools available to `execute`.","Analyze the user request first, then pass `tools` with only the tool names the request needs (every name is listed in this input schema / description); omit `tools` only when you cannot tell which tools apply.","Always call this before your first `execute` and never guess signatures. Request every tool the task may need in ONE call instead of calling this repeatedly."].join(`
4
- `);function m(e,t=[]){const o=["This server exposes documentation tools (API discovery, endpoint details, security schemes, full-text search) through `describe-tools` and `execute`:","- `describe-tools` returns the exact TypeScript signatures of the sandbox tools.","- `execute` runs JavaScript that calls those tools on the global `tools` object.","Workflow: analyze the request, call `describe-tools` once with `tools` set to only the names it needs, then batch everything into a single `execute` script. Minimize round-trips and never guess tool signatures.",...e?["The sandbox also has a global `fetch` that can call the documented APIs (allow-listed hosts only). Include `fetch` in your `describe-tools` call to get its contract and the list of callable APIs."]:[]].join(`
5
- `);return a(o,t)}const l=["listApis","getEndpoints"],c=["Example - list the write endpoints of an API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const [api] = items;",`if (!api) return { error: 'no API matches "billing"' };`,"const { endpoints } = await tools.getEndpoints({ name: api.name });","const writes = endpoints.filter((e) => e.method !== 'GET');","return { api: api.name, writes: writes.map((e) => `${e.method} ${e.path}`) };","```"].join(`
6
- `);function g(e){if(l.every(o=>e.includes(o)))return c;const[t]=e;return t?[`Example - call \`${t}\` and return what the request needs:`,"","```ts",`const result = await tools.${t}({ /* the input its signature above declares */ });`,"return result;","```"].join(`
7
- `):""}const b=["Types named `OpenApi\u2026` are the standard OpenAPI Specification objects.","Payload samples live on a media type object (`requestBody.content[mediaType]`, `responses[code].content[mediaType]`): `.example` holds a single value, `.examples[name].value` a named map, and some descriptions only set `.schema.example`. Read each before concluding a sample is absent."].join(`
8
- `);export{p as DESCRIBE_TOOLS_DESCRIPTION,r as DESCRIPTION_CHAR_LIMIT,d as EXECUTE_ARGS_NOTE,b as USAGE_NOTES,m as buildCodeModeInstructions,h as buildExecuteDescription,g as buildExecuteExample};
1
+ import{buildToolList as c}from"./build-tool-list.js";const n=2048,m="Both `execute` arguments are required: `code` (the JavaScript to run; return a value to receive it) and `description` (a short human-readable summary of what the code does).",a="Available tools (exact signatures come from `describe-tools`):";function i(e,t){if(t.length===0)return e;const o=n-e.length-a.length-3,s=c(t,o);return s?[e,"",a,s].join(`
2
+ `):e}const u="Run JavaScript in a sandbox against the documentation tools on the global `tools` object.";function r(e,t){return[e,t?"The extra globals are `tools`, `fetch`, `URL`, `URLSearchParams`, and `FormData` - there is no `console`, `setTimeout`, `require`, or Node.js API; all other I/O goes through `tools`.":"The only extra global is `tools` - there is no `fetch`, `console`, `setTimeout`, `require`, or Node.js API; all I/O goes through `tools`.","","Workflow - minimize round-trips; one `describe-tools` call plus one `execute` call covers most requests:","1. Analyze the request and decide which sandbox tools it needs.","2. Call `describe-tools` with those names to get their exact TypeScript signatures - inputs, result shapes, and a worked example. NEVER call `execute` with guessed method names, parameter names, enum values, or result field names: read fields off the declared return types, not from assumptions.","3. Batch everything into a SINGLE script: chain tool calls, pass one call's output into the next, process results in plain JavaScript, and `return` only what the request needs."].join(`
3
+ `)}function g(e,t=[],o){const s=o&&r(`Run JavaScript in a sandbox against the tools for the documentation at ${o}. The tools are on the global \`tools\` object.`,e),l=s&&s.length<=n?s:r(u,e);return i(l,t)}const b=["Get the exact TypeScript signatures of the sandbox tools available to `execute`.","Analyze the user request first, then pass `tools` with only the tool names the request needs (every name is listed in this input schema / description); omit `tools` only when you cannot tell which tools apply.","Always call this before your first `execute` and never guess signatures. Request every tool the task may need in ONE call instead of calling this repeatedly."].join(`
4
+ `);function x(e,t=[]){const o=["This server exposes documentation tools (API discovery, endpoint details, security schemes, full-text search) through `describe-tools` and `execute`:","- `describe-tools` returns the exact TypeScript signatures of the sandbox tools.","- `execute` runs JavaScript that calls those tools on the global `tools` object.","Workflow: analyze the request, call `describe-tools` once with `tools` set to only the names it needs, then batch everything into a single `execute` script. Minimize round-trips and never guess tool signatures.",...e?["The sandbox also has a global `fetch` that can call the documented APIs (allow-listed hosts only). Include `fetch` in your `describe-tools` call to get its contract and the list of callable APIs."]:[]].join(`
5
+ `);return i(o,t)}const h=["listApis","getEndpoints"],d=["Example - list the write endpoints of an API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const [api] = items;",`if (!api) return { error: 'no API matches "billing"' };`,"const { endpoints } = await tools.getEndpoints({ name: api.name });","const writes = endpoints.filter((e) => e.method !== 'GET');","return { api: api.name, writes: writes.map((e) => `${e.method} ${e.path}`) };","```"].join(`
6
+ `);function f(e){if(h.every(o=>e.includes(o)))return d;const[t]=e;return t?[`Example - call \`${t}\` and return what the request needs:`,"","```ts",`const result = await tools.${t}({ /* the input its signature above declares */ });`,"return result;","```"].join(`
7
+ `):""}const y=["Types named `OpenApi\u2026` are the standard OpenAPI Specification objects.","Payload samples live on a media type object (`requestBody.content[mediaType]`, `responses[code].content[mediaType]`): `.example` holds a single value, `.examples[name].value` a named map, and some descriptions only set `.schema.example`. Read each before concluding a sample is absent."].join(`
8
+ `);export{b as DESCRIBE_TOOLS_DESCRIPTION,n as DESCRIPTION_CHAR_LIMIT,m as EXECUTE_ARGS_NOTE,y as USAGE_NOTES,x as buildCodeModeInstructions,g as buildExecuteDescription,f as buildExecuteExample};
@@ -1,3 +1,3 @@
1
- import{renderDescribeToolsOutput as _}from"../capabilities/index.js";import{McpServerType as u}from"../../constants.js";import{logMcpToolCallAudit as E,reportMcpToolCalled as k,reportMcpToolError as C}from"../../workers/mcp-tool-telemetry.js";import{DESCRIBE_TOOLS_TOOL_NAME as l}from"../constants.js";import{DESCRIBE_TOOLS_DESCRIPTION as j}from"../prompts.js";import{sanitizeToolName as s}from"../build-tool-type-declarations.js";import{UnknownToolError as O}from"./tool-errors.js";import{callAttribution as N}from"../../utils/telemetry-attributes.js";function U(c,f){const r=[...new Set([...c.map(n=>s(n.name)),...f.map(n=>s(n.id))])];return{name:l,title:"Describe tools",description:j,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},schema:{type:"object",required:[],additionalProperties:!1,properties:{tools:{type:"array",description:`Tool names to describe: ${r.join(", ")}. Omit to describe everything.`,items:r.length>0?{type:"string",enum:r}:{type:"string"},nullable:!0}}}}}function x(c,f,r,n){const p=new Map(c.map(t=>[s(t.name),t])),w=new Map(r.map(t=>[s(t.id),t]));return async t=>{const b=performance.now(),m=n.mcpMode??"code",d=N(n);try{const o=[...new Set((t.tools??[]).map(s))],i=o.length===0,a=o.filter(e=>!p.has(e)&&!w.has(e));if(a.length>0){const e=[...p.keys(),...w.keys()];throw new O(`Unknown tool(s): ${a.join(", ")}. Valid tools: ${e.join(", ")}.`)}const S=i?r:r.filter(e=>o.includes(s(e.id))),T=i?c:o.filter(e=>p.has(e)).map(e=>p.get(e)),v=await Promise.all(T.map(e=>f(e.name))),D=T.filter((e,y)=>v[y]),M=T.filter((e,y)=>!v[y]),g=[_(D,S,n)];M.length>0&&g.push(`Not available for this request: ${M.map(e=>s(e.name)).join(", ")}`);const h=g.join(`
1
+ import{renderDescribeToolsOutput as N}from"../capabilities/index.js";import{McpServerType as u,READ_ONLY_ANNOTATIONS as D}from"../../constants.js";import{logMcpToolCallAudit as E,reportMcpToolCalled as k,reportMcpToolError as C}from"../../workers/mcp-tool-telemetry.js";import{DESCRIBE_TOOLS_TOOL_NAME as l}from"../constants.js";import{DESCRIBE_TOOLS_DESCRIPTION as j}from"../prompts.js";import{sanitizeToolName as s}from"../build-tool-type-declarations.js";import{UnknownToolError as O}from"./tool-errors.js";import{callAttribution as A}from"../../utils/telemetry-attributes.js";function B(c,f){const r=[...new Set([...c.map(n=>s(n.name)),...f.map(n=>s(n.id))])];return{name:l,title:"Get docs function signatures",description:j,annotations:D,schema:{type:"object",required:[],additionalProperties:!1,properties:{tools:{type:"array",description:`Tool names to describe: ${r.join(", ")}. Omit to describe everything.`,items:r.length>0?{type:"string",enum:r}:{type:"string"},nullable:!0}}}}}function z(c,f,r,n){const p=new Map(c.map(t=>[s(t.name),t])),w=new Map(r.map(t=>[s(t.id),t]));return async t=>{const b=performance.now(),m=n.mcpMode??"code",d=A(n);try{const e=[...new Set((t.tools??[]).map(s))],i=e.length===0,a=e.filter(o=>!p.has(o)&&!w.has(o));if(a.length>0){const o=[...p.keys(),...w.keys()];throw new O(`Unknown tool(s): ${a.join(", ")}. Valid tools: ${o.join(", ")}.`)}const S=i?r:r.filter(o=>e.includes(s(o.id))),T=i?c:e.filter(o=>p.has(o)).map(o=>p.get(o)),g=await Promise.all(T.map(o=>f(o.name))),_=T.filter((o,y)=>g[y]),v=T.filter((o,y)=>!g[y]),M=[N(_,S,n)];v.length>0&&M.push(`Not available for this request: ${v.map(o=>s(o.name)).join(", ")}`);const h=M.join(`
2
2
 
3
- `);return E({tool:l,mode:m,serverType:u.Docs,args:t,result:h,...d}),k({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),outputLength:h.length,...d}),{content:[{type:"text",text:h}]}}catch(o){const i=o instanceof O,a=i?"tool_error":"server_error";throw E({tool:l,mode:m,serverType:u.Docs,args:t,errorClass:a,...d}),C({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),message:o instanceof Error?o.message:String(o),stack:!i&&o instanceof Error&&o.stack||"",errorClass:a,...d}),o}}}export{x as describeTools,U as describeToolsSchema};
3
+ `);return E({tool:l,mode:m,serverType:u.Docs,args:t,result:h,...d}),k({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),outputLength:h.length,...d}),{content:[{type:"text",text:h}]}}catch(e){const i=e instanceof O,a=i?"tool_error":"server_error";throw E({tool:l,mode:m,serverType:u.Docs,args:t,errorClass:a,...d}),C({tool:l,mode:m,serverType:u.Docs,durationMs:Math.round(performance.now()-b),message:e instanceof Error?e.message:String(e),stack:!i&&e instanceof Error&&e.stack||"",errorClass:a,...d}),e}}}export{z as describeTools,B as describeToolsSchema};
@@ -1,3 +1,5 @@
1
+ import type { ToolAnnotations } from '@modelcontextprotocol/server';
1
2
  import type { McpToolSchema } from '../../../../types';
3
+ export declare function executeToolTitle(annotations: ToolAnnotations): string;
2
4
  export declare const EXECUTE_TOOL_SCHEMA: McpToolSchema;
3
5
  //# sourceMappingURL=execute-schema.d.ts.map
@@ -1 +1 @@
1
- import{EXECUTE_TOOL_NAME as e}from"../constants.js";import{buildExecuteDescription as t}from"../prompts.js";const r={name:e,title:"Execute code",description:t(!1),schema:{type:"object",required:["code","description"],additionalProperties:!1,properties:{code:{type:"string",description:"JavaScript to run in the sandbox. Return a value to receive it as the result.",minLength:1},description:{type:"string",description:"A short, human-readable summary of what this code does.",minLength:1},sessionHandle:{type:"string",description:"Handle returned by createAnonymousSession. Required when an API needs credentials. This parameter is only offered when createAnonymousSession is available, so pass it whenever you have called that tool.",minLength:1}}},outputSchema:{type:"object",properties:{result:{description:"The value the code returned, as JSON"},error:{type:"string",description:"Why the code failed. Set only on a failed call"}}}};export{r as EXECUTE_TOOL_SCHEMA};
1
+ import{EXECUTE_TOOL_NAME as o}from"../constants.js";import{buildExecuteDescription as i}from"../prompts.js";const e="Execute code";function s(t){return t.readOnlyHint?"Query the docs with code":e}const a={name:o,title:e,description:i(!1),schema:{type:"object",required:["code","description"],additionalProperties:!1,properties:{code:{type:"string",description:"JavaScript to run in the sandbox. Return a value to receive it as the result.",minLength:1},description:{type:"string",description:"A short, human-readable summary of what this code does.",minLength:1},sessionHandle:{type:"string",description:"Handle returned by createAnonymousSession. Required when an API needs credentials. This parameter is only offered when createAnonymousSession is available, so pass it whenever you have called that tool.",minLength:1}}},outputSchema:{type:"object",properties:{result:{description:"The value the code returned, as JSON"},error:{type:"string",description:"Why the code failed. Set only on a failed call"}}}};export{a as EXECUTE_TOOL_SCHEMA,s as executeToolTitle};
@@ -1,3 +1,4 @@
1
+ import type { ToolAnnotations } from '@modelcontextprotocol/server';
1
2
  export declare const McpServerType: {
2
3
  readonly Docs: 'docs';
3
4
  };
@@ -17,5 +18,6 @@ export declare const SUPPORTED_MCP_SCOPES: readonly ['openid', 'profile', 'email
17
18
  export declare const CREATE_ANONYMOUS_SESSION_TOOL_NAME = "createAnonymousSession";
18
19
  export declare const SUBMIT_FEEDBACK_TOOL_NAME = "submit-feedback";
19
20
  export declare const MANAGE_API_CREDENTIALS_TOOL_NAME = "manageApiCredentials";
21
+ export declare const READ_ONLY_ANNOTATIONS: ToolAnnotations;
20
22
  export declare const CUSTOM_MCP_TOOLS_META_DIR = "custom-mcp-tools-meta";
21
23
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- import{LATEST_PROTOCOL_VERSION as o}from"@modelcontextprotocol/server";const t={Docs:"docs"},E={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},_=o,r=3e4,s=15e3,O=3,n="Docs MCP server",S=["openid","profile","email","offline_access"],c="createAnonymousSession",T="submit-feedback",M="manageApiCredentials",A="custom-mcp-tools-meta";export{c as CREATE_ANONYMOUS_SESSION_TOOL_NAME,A as CUSTOM_MCP_TOOLS_META_DIR,r as DEFAULT_CONNECTION_TIMEOUT_MS,n as DEFAULT_DOCS_MCP_SERVER_NAME,M as MANAGE_API_CREDENTIALS_TOOL_NAME,O as MAX_DOCUMENTS_PER_CATEGORY,_ as MCP_PROTOCOL_VERSION,E as McpErrorCodes,t as McpServerType,s as SSE_KEEPALIVE_INTERVAL_MS,T as SUBMIT_FEEDBACK_TOOL_NAME,S as SUPPORTED_MCP_SCOPES};
1
+ import{LATEST_PROTOCOL_VERSION as o}from"@modelcontextprotocol/server";const t={Docs:"docs"},r={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},_=o,E=3e4,s=15e3,O=3,n="Docs MCP server",c=["openid","profile","email","offline_access"],S="createAnonymousSession",T="submit-feedback",A="manageApiCredentials",p={readOnlyHint:!0,destructiveHint:!1,openWorldHint:!1},M="custom-mcp-tools-meta";export{S as CREATE_ANONYMOUS_SESSION_TOOL_NAME,M as CUSTOM_MCP_TOOLS_META_DIR,E as DEFAULT_CONNECTION_TIMEOUT_MS,n as DEFAULT_DOCS_MCP_SERVER_NAME,A as MANAGE_API_CREDENTIALS_TOOL_NAME,O as MAX_DOCUMENTS_PER_CATEGORY,_ as MCP_PROTOCOL_VERSION,r as McpErrorCodes,t as McpServerType,p as READ_ONLY_ANNOTATIONS,s as SSE_KEEPALIVE_INTERVAL_MS,T as SUBMIT_FEEDBACK_TOOL_NAME,c as SUPPORTED_MCP_SCOPES};
@@ -1 +1 @@
1
- import{SEMANTIC_SEARCH_API_URL as y}from"../../../constants/common.js";import{shouldHandleMcpAuth as f}from"../../../utils/rbac/should-handle-mcp-auth.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as g,SUBMIT_FEEDBACK_TOOL_NAME as b}from"../constants.js";import{GRAPHQL_TYPE_KINDS as l,GRAPHQL_LIST_SCOPES as v}from"./tools/graphql/constants.js";import{OPERATION_METHODS as c}from"./tools/openapi/constants.js";const i={type:"string",nullable:!0},s={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},a={codemodeType:"OpenApiServer[]"},o={codemodeType:"OpenApiSecurityRequirement[]"},u={codemodeType:"Record<string, OpenApiSecurityScheme>"},P={codemodeType:"OpenApiDocument"},A={codemodeType:"OpenApiOperation & { path: string; method: string }"},S={codemodeType:"OpenApiComponents",description:"Components the endpoint references. A `$ref` in `endpoint` resolves against the root of the result."},n={filePath:{type:"string",description:"API definition file path"},otherMatches:{type:"array",description:"Other API definitions the lookup also matched. Present only when several matched; pass `filePath` to pick another one",items:{type:"object",required:["filePath"],properties:{version:{type:"string"},filePath:{type:"string"}}}}},r="When several definitions match the name, the highest version or the shortest file path is used and the rest are listed in `otherMatches`; tell the user which version or file the answer is based on.",H="A `$ref` in `endpoint` points into the `components` key at the root of the result: read `#/components/<section>/<name>` there.",L={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"Matches part of an API name, or of a description when no name matches",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}},p={type:"object",required:[],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it. Omit when `filePath` is given.",minLength:1,nullable:!0},apiName:{type:"string",description:"Alias of `name`",nullable:!0},api:{type:"string",description:"Alias of `name`",nullable:!0},version:{type:"string",description:"API version. When omitted and several versions exist, the highest one is used",nullable:!0},filePath:{type:"string",description:"API definition file path, as returned by `listApis`",nullable:!0}}},q={type:"object",required:["path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it. Omit when `filePath` is given.",minLength:1,nullable:!0},apiName:{type:"string",description:"Alias of `name`",nullable:!0},api:{type:"string",description:"Alias of `name`",nullable:!0},path:{type:"string",description:"Endpoint path (e.g. /api/v1/users)",minLength:1},method:{type:"string",description:"HTTP method (GET, POST, PUT, DELETE, etc.)",enum:[...c.map(e=>e.toUpperCase()),...c],minLength:1},version:{type:"string",description:"API version. When omitted and several versions exist, the highest one is used",nullable:!0},filePath:{type:"string",description:"API definition file path, as returned by `listApis`",nullable:!0}}},O={type:"object",required:[],additionalProperties:!1,properties:{}},T={type:"object",required:[],additionalProperties:!1,properties:{}},G={type:"object",required:["path","summary"],additionalProperties:!1,properties:{path:{type:"string",description:"Path or URL of the documentation page the feedback is about (e.g. /guides/auth)",minLength:1,maxLength:1e3},summary:{type:"string",description:"One sentence that names what is wrong with the page",minLength:1,maxLength:500},details:{type:"string",description:"Expected versus actual behavior, missing steps, or the snippet that failed",maxLength:4e3,nullable:!0},targetFeature:{type:"string",description:"The API or feature the page documents",maxLength:500,nullable:!0}}};function I(e){const t=[{name:"list-apis",title:"List APIs",description:"Lists the APIs documented in this project",schema:L,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["items","limit","total","page","totalPages"],properties:{items:{type:"array",items:{type:"object",required:["name","description","version","servers","filePath"],properties:{name:{type:"string"},description:{type:"string"},version:{type:"string"},servers:a,filePath:{type:"string",description:"API definition file path"},ambiguousTitle:{type:"boolean",description:"true = another API shares this title; a lookup picks the highest version, or the shortest file path at the same version, and lists the rest in `otherMatches`. Pass `filePath` to pick another one"},...e.hasCallableApis?{callable:{type:"boolean",description:"true = the documented hosts of this API are reachable via `fetch`; false = documentation only"}}:{}}}},...s}}},{name:"get-endpoints",title:"Get endpoints",description:`Get all endpoints for a specific API. ${r}`,schema:p,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["api","version","filePath","servers","endpoints"],properties:{api:{type:"string"},version:{type:"string"},...n,servers:a,endpoints:{type:"array",items:{type:"object",required:["path","method"],properties:{path:{type:"string"},method:{type:"string"},summary:i,description:i,security:o}}}}}},{name:"get-endpoint-info",title:"Get endpoint info",description:`Get comprehensive information about specific endpoint including parameters, security, and examples. ${H} ${r}`,schema:q,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["api","version","filePath","servers","endpoint","globalSecurity","securitySchemes"],properties:{api:{type:"string"},version:{type:"string"},...n,servers:a,endpoint:A,globalSecurity:o,securitySchemes:u,components:S}}},{name:"get-security-schemes",title:"Get security schemes",description:`Get the security schemes for a specific API. ${r}`,schema:p,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["api","version","filePath","securitySchemes","security"],properties:{api:{type:"string"},version:{type:"string"},...n,securitySchemes:u,security:o}}},{name:"get-full-api-description",title:"Get full API description",description:`Get the complete OpenAPI description. ${r}`,schema:p,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["api","version","filePath","definition"],properties:{api:{type:"string"},version:{type:"string"},...n,definition:P}}},...y?[d(e.products,e.locales)]:[]];return f(e.requiresLogin,e.rbac)&&t.push({name:"whoami",title:"Who am I",description:"Get information about the currently authenticated user",schema:O,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["authenticated"],properties:{authenticated:{type:"boolean"},email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.feedbackHidden||t.push({name:b,title:"Submit feedback",description:"Report a documentation page that is wrong or incomplete",schema:G,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"object",required:["status","page","message"],properties:{status:{type:"string"},page:{type:"string"},message:{type:"string"}}}}),e.hasGraphqlApis&&t.push(...k()),e.elicitationEnabled&&e.hasCallableApis&&t.push({name:g,title:"Create anonymous session",description:"Create an anonymous session handle for storing upstream API credentials. Pass the returned sessionHandle to execute when an API needs credentials and the caller is not signed in. Treat it as a secret and reuse it across calls.",schema:T,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"object",required:["sessionHandle"],properties:{sessionHandle:{type:"string"}}}}),t}const w={type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema name (or part of it)",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},j={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},kind:{type:"string",description:'Optional: return only a single category of schema members. With scope "fields", restricts to the fields of that parent category ("objects", "interfaces", or "inputs" only).',enum:[...l,null],nullable:!0},scope:{type:"string",description:'Optional: what each list item is. "members" (default) lists top-level types and operations. "fields" flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions \u2014 combine with `filter` to search nested fields anywhere in the schema.',enum:[...v,null],nullable:!0},filter:{type:"string",description:'Optional: only members whose name or description contains this substring, case-insensitive (e.g. "custom tags")',minLength:1,nullable:!0},referencesType:{type:"string",description:'Optional: only members that reference this type directly or transitively (via return, field, argument, union-member or input-field types). Finds cross-cutting members that never name it \u2014 e.g. referencesType "Book" surfaces a search query returning a union that includes Book.',minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},E={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},type:{type:"string",description:"Name of the type, operation, or directive",minLength:1,nullable:!0},typeName:{type:"string",description:"Alias of `type`",nullable:!0},includeReferencedTypes:{type:"boolean",description:"Also include the SDL of every type referenced transitively. Gives the whole subgraph at once, but can be large for highly-connected types.",default:!1,nullable:!0}}},N={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function k(){return[{name:"list-graphql-apis",title:"List GraphQL APIs",description:"Lists available GraphQL schemas with their context and purpose",schema:w,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["items","limit","total","page","totalPages"],properties:{items:{type:"array",items:{type:"object",required:["name"],properties:{name:{type:"string"},description:i}}},...s}}},{name:"get-graphql-type-list",title:"Get GraphQL type list",description:'List all operations and types in a GraphQL schema as a flat, paginated list. Each item is tagged with its kind (query, object, enum, \u2026) and carries a one-line description; operations also include their return type and argument signature \u2014 use it to decide which members to fetch in detail. Narrow the result with `kind` (one category), `filter` (case-insensitive substring of the member name or description, e.g. "book"), or `referencesType` (only members that use a given type, directly or transitively) to explore a domain cheaply instead of pulling the full schema. To search nested fields \u2014 not just type names \u2014 set scope "fields": it flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions, so `filter` finds things like an input field whose docstring mentions your keyword.',schema:j,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",required:["name","items","limit","total","page","totalPages"],properties:{name:{type:"string"},items:{type:"array",items:{type:"object",required:["kind","name"],properties:{kind:{type:"string",enum:l},name:{type:"string"},description:i,type:{type:"string"},args:{type:"string"},directives:{type:"string"}}}},...s}}},{name:"get-graphql-type",title:"Get GraphQL type",description:'Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Without includeReferencedTypes, the SDL is followed by a one-level manifest of every directly referenced type\'s field names (e.g. "input ActionOperationInput { addTags, removeTags }"), so you can see what nested types contain before fetching them. Set includeReferencedTypes to instead pull in the full SDL of every type it references transitively \u2014 the whole structural subgraph in one call, ideal for complete exploration of an entity (e.g. Book and all the types it touches). That traversal only follows what the target depends on; to go the other direction and find the members that use a type, call get-graphql-type-list with `referencesType`.',schema:E,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}},{name:"get-graphql-schema",title:"Get GraphQL schema",description:"Get the complete GraphQL schema as SDL \u2014 the whole type graph in one call. Returns everything, so it can be very large and token-expensive for big schemas; prefer get-graphql-type-list (filter/paginate) plus targeted get-graphql-type calls, and reach for this only for small schemas or when you truly need the full SDL.",schema:N,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function d(e,t){const h=e&&e.length>0,m=t&&t.length>0;return{name:"search",title:"Search documentation",description:"Search across the documentation to fetch relevant content for a given query",schema:{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...h?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:[...e,null],nullable:!0}}:{},...m?{locale:{type:"string",description:"Optional locale code to filter search results by documentation language (e.g. 'en', 'ja'). Use the locale matching the language of the user's request. Defaults to the project's default locale.",enum:[...t,null],nullable:!0}}:{}}},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}const Q=new Set([...I({requiresLogin:!0,hasGraphqlApis:!0,elicitationEnabled:!0,hasCallableApis:!0}).map(e=>e.name),d().name]);export{Q as ALL_DEFAULT_TOOL_NAMES,I as getDefaultToolSchemas};
1
+ import{SEMANTIC_SEARCH_API_URL as g}from"../../../constants/common.js";import{shouldHandleMcpAuth as f}from"../../../utils/rbac/should-handle-mcp-auth.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as b,READ_ONLY_ANNOTATIONS as t,SUBMIT_FEEDBACK_TOOL_NAME as A}from"../constants.js";import{GRAPHQL_TYPE_KINDS as c,GRAPHQL_LIST_SCOPES as P}from"./tools/graphql/constants.js";import{OPERATION_METHODS as h}from"./tools/openapi/constants.js";const n={type:"string",nullable:!0},a={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},o={codemodeType:"OpenApiServer[]"},p={codemodeType:"OpenApiSecurityRequirement[]"},u={codemodeType:"Record<string, OpenApiSecurityScheme>"},v={codemodeType:"OpenApiDocument"},S={codemodeType:"OpenApiOperation & { path: string; method: string }"},L={codemodeType:"OpenApiComponents",description:"Components the endpoint references. A `$ref` in `endpoint` resolves against the root of the result."},r={filePath:{type:"string",description:"API definition file path"},otherMatches:{type:"array",description:"Other API definitions the lookup also matched. Present only when several matched; pass `filePath` to pick another one",items:{type:"object",required:["filePath"],properties:{version:{type:"string"},filePath:{type:"string"}}}}},s="When several definitions match the name, the highest version or the shortest file path is used and the rest are listed in `otherMatches`; tell the user which version or file the answer is based on.",q="A `$ref` in `endpoint` points into the `components` key at the root of the result: read `#/components/<section>/<name>` there.",T={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"Matches part of an API name, or of a description when no name matches",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}},l={type:"object",required:[],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it. Omit when `filePath` is given.",minLength:1,nullable:!0},apiName:{type:"string",description:"Alias of `name`",nullable:!0},api:{type:"string",description:"Alias of `name`",nullable:!0},version:{type:"string",description:"API version. When omitted and several versions exist, the highest one is used",nullable:!0},filePath:{type:"string",description:"API definition file path from the API list",nullable:!0}}},I={type:"object",required:["path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it. Omit when `filePath` is given.",minLength:1,nullable:!0},apiName:{type:"string",description:"Alias of `name`",nullable:!0},api:{type:"string",description:"Alias of `name`",nullable:!0},path:{type:"string",description:"Endpoint path (e.g. /api/v1/users)",minLength:1},method:{type:"string",description:"HTTP method (GET, POST, PUT, DELETE, etc.)",enum:[...h.map(e=>e.toUpperCase()),...h],minLength:1},version:{type:"string",description:"API version. When omitted and several versions exist, the highest one is used",nullable:!0},filePath:{type:"string",description:"API definition file path from the API list",nullable:!0}}},O={type:"object",required:[],additionalProperties:!1,properties:{}},G={type:"object",required:[],additionalProperties:!1,properties:{}},w={type:"object",required:["path","summary"],additionalProperties:!1,properties:{path:{type:"string",description:"Path or URL of the documentation page the feedback is about (e.g. /guides/auth)",minLength:1,maxLength:1e3},summary:{type:"string",description:"One sentence that names what is wrong with the page",minLength:1,maxLength:500},details:{type:"string",description:"Expected versus actual behavior, missing steps, or the snippet that failed",maxLength:4e3,nullable:!0},targetFeature:{type:"string",description:"The API or feature the page documents",maxLength:500,nullable:!0}}};function j(e){const i=[{name:"list-apis",title:"List APIs",description:"Lists the APIs documented in this project",schema:T,annotations:t,outputSchema:{type:"object",required:["items","limit","total","page","totalPages"],properties:{items:{type:"array",items:{type:"object",required:["name","description","version","servers","filePath"],properties:{name:{type:"string"},description:{type:"string"},version:{type:"string"},servers:o,filePath:{type:"string",description:"API definition file path"},ambiguousTitle:{type:"boolean",description:"true = another API shares this title; a lookup picks the highest version, or the shortest file path at the same version, and lists the rest in `otherMatches`. Pass `filePath` to pick another one"},...e.hasCallableApis?{callable:{type:"boolean",description:"true = the documented hosts of this API are reachable via `fetch`; false = documentation only"}}:{}}}},...a}}},{name:"get-endpoints",title:"Get endpoints",description:`Get all endpoints for a specific API. ${s}`,schema:l,annotations:t,outputSchema:{type:"object",required:["api","version","filePath","servers","endpoints"],properties:{api:{type:"string"},version:{type:"string"},...r,servers:o,endpoints:{type:"array",items:{type:"object",required:["path","method"],properties:{path:{type:"string"},method:{type:"string"},summary:n,description:n,security:p}}}}}},{name:"get-endpoint-info",title:"Get endpoint info",description:`Get comprehensive information about specific endpoint including parameters, security, and examples. ${q} ${s}`,schema:I,annotations:t,outputSchema:{type:"object",required:["api","version","filePath","servers","endpoint","globalSecurity","securitySchemes"],properties:{api:{type:"string"},version:{type:"string"},...r,servers:o,endpoint:S,globalSecurity:p,securitySchemes:u,components:L}}},{name:"get-security-schemes",title:"Get security schemes",description:`Get the security schemes for a specific API. ${s}`,schema:l,annotations:t,outputSchema:{type:"object",required:["api","version","filePath","securitySchemes","security"],properties:{api:{type:"string"},version:{type:"string"},...r,securitySchemes:u,security:p}}},{name:"get-full-api-description",title:"Get full API description",description:`Get the complete OpenAPI description. ${s}`,schema:l,annotations:t,outputSchema:{type:"object",required:["api","version","filePath","definition"],properties:{api:{type:"string"},version:{type:"string"},...r,definition:v}}},...g?[m(e.products,e.locales)]:[]];return f(e.requiresLogin,e.rbac)&&i.push({name:"whoami",title:"Who am I",description:"Get information about the currently authenticated user",schema:O,annotations:t,outputSchema:{type:"object",required:["authenticated"],properties:{authenticated:{type:"boolean"},email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.feedbackHidden||i.push({name:A,title:"Submit feedback",description:"Report a documentation page that is wrong or incomplete",schema:w,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},outputSchema:{type:"object",required:["status","page","message"],properties:{status:{type:"string"},page:{type:"string"},message:{type:"string"}}}}),e.hasGraphqlApis&&i.push(...D()),e.elicitationEnabled&&e.hasCallableApis&&i.push({name:b,title:"Create anonymous session",description:"Create an anonymous session handle for storing upstream API credentials. Pass the returned sessionHandle to execute when an API needs credentials and the caller is not signed in. Treat it as a secret and reuse it across calls.",schema:G,annotations:t,outputSchema:{type:"object",required:["sessionHandle"],properties:{sessionHandle:{type:"string"}}}}),i}const E={type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema name (or part of it)",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},N={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},kind:{type:"string",description:'Optional: return only a single category of schema members. With scope "fields", restricts to the fields of that parent category ("objects", "interfaces", or "inputs" only).',enum:[...c,null],nullable:!0},scope:{type:"string",description:'Optional: what each list item is. "members" (default) lists top-level types and operations. "fields" flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions \u2014 combine with `filter` to search nested fields anywhere in the schema.',enum:[...P,null],nullable:!0},filter:{type:"string",description:'Optional: only members whose name or description contains this substring, case-insensitive (e.g. "custom tags")',minLength:1,nullable:!0},referencesType:{type:"string",description:'Optional: only members that reference this type directly or transitively (via return, field, argument, union-member or input-field types). Finds cross-cutting members that never name it \u2014 e.g. referencesType "Book" surfaces a search query returning a union that includes Book.',minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},_={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},type:{type:"string",description:"Name of the type, operation, or directive",minLength:1,nullable:!0},typeName:{type:"string",description:"Alias of `type`",nullable:!0},includeReferencedTypes:{type:"boolean",description:"Also include the SDL of every type referenced transitively. Gives the whole subgraph at once, but can be large for highly-connected types.",default:!1,nullable:!0}}},k={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function D(){return[{name:"list-graphql-apis",title:"List GraphQL APIs",description:"Lists available GraphQL schemas with their context and purpose",schema:E,annotations:t,outputSchema:{type:"object",required:["items","limit","total","page","totalPages"],properties:{items:{type:"array",items:{type:"object",required:["name"],properties:{name:{type:"string"},description:n}}},...a}}},{name:"get-graphql-type-list",title:"Get GraphQL type list",description:'List all operations and types in a GraphQL schema as a flat, paginated list. Each item is tagged with its kind (query, object, enum, \u2026) and carries a one-line description; operations also include their return type and argument signature \u2014 use it to decide which members to fetch in detail. Narrow the result with `kind` (one category), `filter` (case-insensitive substring of the member name or description, e.g. "book"), or `referencesType` (only members that use a given type, directly or transitively) to explore a domain cheaply instead of pulling the full schema. To search nested fields \u2014 not just type names \u2014 set scope "fields": it flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions, so `filter` finds things like an input field whose docstring mentions your keyword.',schema:N,annotations:t,outputSchema:{type:"object",required:["name","items","limit","total","page","totalPages"],properties:{name:{type:"string"},items:{type:"array",items:{type:"object",required:["kind","name"],properties:{kind:{type:"string",enum:c},name:{type:"string"},description:n,type:{type:"string"},args:{type:"string"},directives:{type:"string"}}}},...a}}},{name:"get-graphql-type",title:"Get GraphQL type",description:'Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Without includeReferencedTypes, the SDL is followed by a one-level manifest of every directly referenced type\'s field names (e.g. "input ActionOperationInput { addTags, removeTags }"), so you can see what nested types contain before fetching them. Set includeReferencedTypes to instead pull in the full SDL of every type it references transitively \u2014 the whole structural subgraph in one call, ideal for complete exploration of an entity (e.g. Book and all the types it touches). That traversal only follows what the target depends on; to go the other direction and find the members that use a type, call get-graphql-type-list with `referencesType`.',schema:_,annotations:t,outputSchema:{type:"string"}},{name:"get-graphql-schema",title:"Get GraphQL schema",description:"Get the complete GraphQL schema as SDL \u2014 the whole type graph in one call. Returns everything, so it can be very large and token-expensive for big schemas; prefer get-graphql-type-list (filter/paginate) plus targeted get-graphql-type calls, and reach for this only for small schemas or when you truly need the full SDL.",schema:k,annotations:t,outputSchema:{type:"string"}}]}function m(e,i){const d=e&&e.length>0,y=i&&i.length>0;return{name:"search",title:"Search documentation",description:"Search across the documentation to fetch relevant content for a given query",schema:{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...d?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:[...e,null],nullable:!0}}:{},...y?{locale:{type:"string",description:"Optional locale code to filter search results by documentation language (e.g. 'en', 'ja'). Use the locale matching the language of the user's request. Defaults to the project's default locale.",enum:[...i,null],nullable:!0}}:{}}},annotations:t,outputSchema:{type:"string"}}}const M=new Set([...j({requiresLogin:!0,hasGraphqlApis:!0,elicitationEnabled:!0,hasCallableApis:!0}).map(e=>e.name),m().name]);export{M as ALL_DEFAULT_TOOL_NAMES,j as getDefaultToolSchemas};
@@ -1 +1 @@
1
- import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as t}from"../../../constants.js";import{isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{createSessionHandle as n}from"../../../gateway-mcp/subject.js";const i=async()=>{const e={sessionHandle:n()};return{content:[{type:"text",text:JSON.stringify(e)}],structuredContent:e}};function s(e){return!!e.elicitationEnabled&&e.mcpMode==="code"&&o(e)&&!e.user?.isAuthenticated}var u={[t]:{execute:i,isAvailable:s}};export{u as default,s as isAnonymousSessionToolAvailable};
1
+ import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as t}from"../../../constants.js";import{isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{createSessionHandle as n}from"../../../gateway-mcp/subject.js";const i=async()=>{const e={sessionHandle:n()};return{content:[{type:"text",text:JSON.stringify(e)}],structuredContent:e}};function s(e){return!!e.elicitationEnabled&&o(e)&&!e.user?.isAuthenticated}var u={[t]:{execute:i,isAvailable:s}};export{u as default,s as isAnonymousSessionToolAvailable};
@@ -1,3 +1,3 @@
1
- import{getPathPrefix as p,withPathPrefix as h,withoutPathPrefix as l}from"@redocly/theme/core/utils";import{ServerRoutes as g}from"../../../../../../constants/api.js";import{normalizeRouteSlug as b}from"../../../../../../utils/path/normalize-route-slug.js";import{SUBMIT_FEEDBACK_TOOL_NAME as y}from"../../../constants.js";const k="mcp",P="mcp-client";function r(t,e=!1){return{content:[{type:"text",text:JSON.stringify(t)}],isError:e}}function i(t){const e=t?.trim();return e||void 0}function U(t){const e=p();return!!e&&(t===e||t.startsWith(`${e}/`))?l(t):t}function F(t,e){try{const{pathname:n}=new URL(t,e),a=new URL(e);return a.pathname=U(b(n)),a.toString()}catch{return}}function T(t){const e=t.client??P;return t.clientVersion?`${e}/${t.clientVersion}`:e}async function A(t){const n=(await t.json().catch(()=>{}))?.errors;return Array.isArray(n)?n.filter(a=>typeof a=="string"):[]}const E=async(t,e)=>{const n=i(t.path),a=i(t.summary);if(!n||!a)return r({error:"Invalid arguments",message:"`path` and `summary` are required."},!0);const c=e.baseUrl;if(!c)return r({error:"Unavailable",message:"The feedback endpoint of this site is not configured."},!0);const s=F(n,c);if(!s)return r({error:"Invalid arguments",message:"`path` must be a page path or URL of this site."},!0);const u=i(t.details),d=T(e),f=e.accessToken?.replace(/^Bearer /,""),m=`${e.internalBaseUrl||c}${h(g.FEEDBACK)}`;let o;try{o=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":d,...f?{Cookie:`authorization=${f}`}:{},...e.clientIp?{"X-Real-IP":e.clientIp}:{}},body:JSON.stringify({component:"comment",path:s,comment:u?`${a}
1
+ import{getPathPrefix as p,withPathPrefix as h,withoutPathPrefix as l}from"@redocly/theme/core/utils";import{ServerRoutes as g}from"../../../../../../constants/api.js";import{normalizeRouteSlug as b}from"../../../../../../utils/path/normalize-route-slug.js";import{SUBMIT_FEEDBACK_TOOL_NAME as y}from"../../../constants.js";const k="mcp",P="mcp-client";function a(e){return{content:[{type:"text",text:JSON.stringify(e)}],isError:!0}}function i(e){const t=e?.trim();return t||void 0}function U(e){const t=p();return!!t&&(e===t||e.startsWith(`${t}/`))?l(e):e}function E(e,t){try{const{pathname:r}=new URL(e,t),n=new URL(t);return n.pathname=U(b(r)),n.toString()}catch{return}}function F(e){const t=e.client??P;return e.clientVersion?`${t}/${e.clientVersion}`:t}async function T(e){const r=(await e.json().catch(()=>{}))?.errors;return Array.isArray(r)?r.filter(n=>typeof n=="string"):[]}const A=async(e,t)=>{const r=i(e.path),n=i(e.summary);if(!r||!n)return a({error:"Invalid arguments",message:"`path` and `summary` are required."});const c=t.baseUrl;if(!c)return a({error:"Unavailable",message:"The feedback endpoint of this site is not configured."});const s=E(r,c);if(!s)return a({error:"Invalid arguments",message:"`path` must be a page path or URL of this site."});const u=i(e.details),d=F(t),f=t.accessToken?.replace(/^Bearer /,""),m=`${t.internalBaseUrl||c}${h(g.FEEDBACK)}`;let o;try{o=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":d,...f?{Cookie:`authorization=${f}`}:{},...t.clientIp?{"X-Real-IP":t.clientIp}:{}},body:JSON.stringify({component:"comment",path:s,comment:u?`${n}
2
2
 
3
- ${u}`:a,agent:d,targetFeature:i(t.targetFeature),origin:k})})}catch{return r({error:"Failed to submit feedback",message:"The feedback endpoint could not be reached."},!0)}return o.status===403?r({error:"Forbidden",message:"You have no access to this page, so feedback for it is not accepted."},!0):o.status===404?r({error:"Not found",message:`No page exists at ${s}.`},!0):o.status===400?r({error:"Invalid feedback",errors:await A(o)},!0):o.ok?r({status:"received",page:s,message:"Thanks for your feedback. The documentation team sees it on the Feedback page."}):r({error:"Failed to submit feedback",message:`The feedback endpoint answered ${o.status}.`},!0)};var N={[y]:E};export{N as default};
3
+ ${u}`:n,agent:d,targetFeature:i(e.targetFeature),origin:k})})}catch{return a({error:"Failed to submit feedback",message:"The feedback endpoint could not be reached."})}return o.status===403?a({error:"Forbidden",message:"You have no access to this page, so feedback for it is not accepted."}):o.status===404?a({error:"Not found",message:`No page exists at ${s}.`}):o.status===400?a({error:"Invalid feedback",errors:await T(o)}):o.ok?{status:"received",page:s,message:"Thanks for your feedback. The documentation team sees it on the Feedback page."}:a({error:"Failed to submit feedback",message:`The feedback endpoint answered ${o.status}.`})};var N={[y]:A};export{N as default};
@@ -2,8 +2,9 @@ import type { ApiDescriptionInfo, McpToolContext } from '../types.js';
2
2
  import type { ExcludedOperation } from './api-call-operations.js';
3
3
  /**
4
4
  * The APIs an agent may call in this request: the build-stamped `fetchEligible` entries of the
5
- * already RBAC-filtered map, minus what `mcp.apiCalls` removes. The config is read from the
6
- * request context, so a `redocly.yaml` edit applies without restarting the dev server.
5
+ * already RBAC-filtered map, minus what `mcp.apiCalls` removes; none outside code mode. The
6
+ * config is read from the request context, so a `redocly.yaml` edit applies without restarting
7
+ * the dev server.
7
8
  * No EntitlementsProvider read — this code runs in graphs where the provider is uninitialized.
8
9
  */
9
10
  export declare function getCallableApis(context: McpToolContext): ApiDescriptionInfo[];
@@ -1 +1 @@
1
- import c from"picomatch";function r(e){const i=e.config?.mcp?.apiCalls;if(i?.hide)return[];const t=c(i?.excludeFiles??[]);return Object.values(e.apiDescriptionsMap??{}).filter(l=>l.fetchEligible&&!t(l.relativePath))}function n(e,i){return(e.config?.mcp?.apiCalls?.excludeOperations??[]).filter(({file:t})=>c.isMatch(i,t))}function p(e){return r(e).length>0}export{r as getCallableApis,n as getExcludedOperations,p as isFetchCapable};
1
+ import c from"picomatch";function r(e){const i=e.config?.mcp?.apiCalls;if(e.mcpMode!=="code"||i?.hide)return[];const t=c(i?.excludeFiles??[]);return Object.values(e.apiDescriptionsMap??{}).filter(l=>l.fetchEligible&&!t(l.relativePath))}function p(e,i){return(e.config?.mcp?.apiCalls?.excludeOperations??[]).filter(({file:t})=>c.isMatch(i,t))}function n(e){return r(e).length>0}export{r as getCallableApis,p as getExcludedOperations,n as isFetchCapable};