@egain/egain-mcp-server 1.0.26 → 1.1.0
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.
- package/README.md +20 -43
- package/bin/mcp-server.js +39534 -29516
- package/bin/mcp-server.js.map +298 -185
- package/esm/src/cloudflare-worker/cloudflare-worker.d.ts.map +1 -1
- package/esm/src/cloudflare-worker/cloudflare-worker.js +20 -9
- package/esm/src/cloudflare-worker/cloudflare-worker.js.map +1 -1
- package/esm/src/funcs/aiSearch.d.ts +63 -0
- package/esm/src/funcs/aiSearch.d.ts.map +1 -0
- package/esm/src/funcs/aiSearch.js +151 -0
- package/esm/src/funcs/aiSearch.js.map +1 -0
- package/esm/src/funcs/getAnnouncementArticles.d.ts +61 -0
- package/esm/src/funcs/getAnnouncementArticles.d.ts.map +1 -0
- package/esm/src/funcs/getAnnouncementArticles.js +152 -0
- package/esm/src/funcs/getAnnouncementArticles.js.map +1 -0
- package/esm/src/funcs/getAnnouncements.d.ts +39 -1
- package/esm/src/funcs/getAnnouncements.d.ts.map +1 -1
- package/esm/src/funcs/getAnnouncements.js +39 -1
- package/esm/src/funcs/getAnnouncements.js.map +1 -1
- package/esm/src/funcs/getArticle.d.ts +42 -0
- package/esm/src/funcs/getArticle.d.ts.map +1 -1
- package/esm/src/funcs/getArticle.js +42 -0
- package/esm/src/funcs/getArticle.js.map +1 -1
- package/esm/src/funcs/getArticleById.d.ts +70 -0
- package/esm/src/funcs/getArticleById.d.ts.map +1 -0
- package/esm/src/funcs/getArticleById.js +163 -0
- package/esm/src/funcs/getArticleById.js.map +1 -0
- package/esm/src/funcs/getBestAnswer.d.ts +66 -0
- package/esm/src/funcs/getBestAnswer.d.ts.map +1 -0
- package/esm/src/funcs/getBestAnswer.js +148 -0
- package/esm/src/funcs/getBestAnswer.js.map +1 -0
- package/esm/src/funcs/getMyPortals.d.ts +97 -0
- package/esm/src/funcs/getMyPortals.d.ts.map +1 -0
- package/esm/src/funcs/getMyPortals.js +180 -0
- package/esm/src/funcs/getMyPortals.js.map +1 -0
- package/esm/src/funcs/getPopularArticles.d.ts +39 -0
- package/esm/src/funcs/getPopularArticles.d.ts.map +1 -1
- package/esm/src/funcs/getPopularArticles.js +47 -3
- package/esm/src/funcs/getPopularArticles.js.map +1 -1
- package/esm/src/funcs/getPortals.d.ts +26 -1
- package/esm/src/funcs/getPortals.d.ts.map +1 -1
- package/esm/src/funcs/getPortals.js +35 -10
- package/esm/src/funcs/getPortals.js.map +1 -1
- package/esm/src/funcs/makeSuggestion.d.ts +46 -2
- package/esm/src/funcs/makeSuggestion.d.ts.map +1 -1
- package/esm/src/funcs/makeSuggestion.js +51 -3
- package/esm/src/funcs/makeSuggestion.js.map +1 -1
- package/esm/src/funcs/queryAnswers.d.ts +41 -5
- package/esm/src/funcs/queryAnswers.d.ts.map +1 -1
- package/esm/src/funcs/queryAnswers.js +41 -5
- package/esm/src/funcs/queryAnswers.js.map +1 -1
- package/esm/src/funcs/queryRetrieve.d.ts +41 -1
- package/esm/src/funcs/queryRetrieve.d.ts.map +1 -1
- package/esm/src/funcs/queryRetrieve.js +41 -1
- package/esm/src/funcs/queryRetrieve.js.map +1 -1
- package/esm/src/funcs/querySearch.d.ts +48 -1
- package/esm/src/funcs/querySearch.d.ts.map +1 -1
- package/esm/src/funcs/querySearch.js +48 -1
- package/esm/src/funcs/querySearch.js.map +1 -1
- package/esm/src/funcs/retrieveChunks.d.ts +41 -7
- package/esm/src/funcs/retrieveChunks.d.ts.map +1 -1
- package/esm/src/funcs/retrieveChunks.js +45 -19
- package/esm/src/funcs/retrieveChunks.js.map +1 -1
- package/esm/src/hooks/auth-hook.d.ts +1 -2
- package/esm/src/hooks/auth-hook.d.ts.map +1 -1
- package/esm/src/hooks/auth-hook.js +1 -65
- package/esm/src/hooks/auth-hook.js.map +1 -1
- package/esm/src/hooks/registration.d.ts.map +1 -1
- package/esm/src/hooks/registration.js +2 -16
- package/esm/src/hooks/registration.js.map +1 -1
- package/esm/src/landing-page.d.ts +5 -0
- package/esm/src/landing-page.d.ts.map +1 -0
- package/esm/src/landing-page.js +1070 -0
- package/esm/src/landing-page.js.map +1 -0
- package/esm/src/lib/base64.d.ts +2 -2
- package/esm/src/lib/base64.d.ts.map +1 -1
- package/esm/src/lib/base64.js +2 -2
- package/esm/src/lib/base64.js.map +1 -1
- package/esm/src/lib/config.d.ts +3 -3
- package/esm/src/lib/config.js +5 -5
- package/esm/src/lib/config.js.map +1 -1
- package/esm/src/lib/encodings.d.ts.map +1 -1
- package/esm/src/lib/encodings.js +10 -1
- package/esm/src/lib/encodings.js.map +1 -1
- package/esm/src/lib/matchers.d.ts.map +1 -1
- package/esm/src/lib/matchers.js +4 -1
- package/esm/src/lib/matchers.js.map +1 -1
- package/esm/src/lib/schemas.d.ts +4 -4
- package/esm/src/lib/schemas.d.ts.map +1 -1
- package/esm/src/lib/schemas.js +2 -2
- package/esm/src/lib/schemas.js.map +1 -1
- package/esm/src/lib/sdks.js +2 -2
- package/esm/src/lib/sdks.js.map +1 -1
- package/esm/src/lib/security.d.ts.map +1 -1
- package/esm/src/lib/security.js +18 -0
- package/esm/src/lib/security.js.map +1 -1
- package/esm/src/mcp-server/cli/start/command.d.ts.map +1 -1
- package/esm/src/mcp-server/cli/start/command.js +30 -0
- package/esm/src/mcp-server/cli/start/command.js.map +1 -1
- package/esm/src/mcp-server/cli/start/impl.d.ts +2 -7
- package/esm/src/mcp-server/cli/start/impl.d.ts.map +1 -1
- package/esm/src/mcp-server/cli/start/impl.js +98 -22
- package/esm/src/mcp-server/cli/start/impl.js.map +1 -1
- package/esm/src/mcp-server/extensions.d.ts +4 -4
- package/esm/src/mcp-server/extensions.d.ts.map +1 -1
- package/esm/src/mcp-server/flags.d.ts +17 -0
- package/esm/src/mcp-server/flags.d.ts.map +1 -0
- package/esm/src/mcp-server/flags.js +5 -0
- package/esm/src/mcp-server/flags.js.map +1 -0
- package/esm/src/mcp-server/mcp-server.js +1 -1
- package/esm/src/mcp-server/mcp-server.js.map +1 -1
- package/esm/src/mcp-server/prompts.d.ts +4 -7
- package/esm/src/mcp-server/prompts.d.ts.map +1 -1
- package/esm/src/mcp-server/prompts.js.map +1 -1
- package/esm/src/mcp-server/server.d.ts +8 -1
- package/esm/src/mcp-server/server.d.ts.map +1 -1
- package/esm/src/mcp-server/server.js +19 -16
- package/esm/src/mcp-server/server.js.map +1 -1
- package/esm/src/mcp-server/tools/aiSearch.d.ts +7 -0
- package/esm/src/mcp-server/tools/aiSearch.d.ts.map +1 -0
- package/esm/src/mcp-server/tools/aiSearch.js +83 -0
- package/esm/src/mcp-server/tools/aiSearch.js.map +1 -0
- package/esm/src/mcp-server/tools/getAnnouncementArticles.d.ts +7 -0
- package/esm/src/mcp-server/tools/getAnnouncementArticles.d.ts.map +1 -0
- package/esm/src/mcp-server/tools/getAnnouncementArticles.js +81 -0
- package/esm/src/mcp-server/tools/getAnnouncementArticles.js.map +1 -0
- package/esm/src/mcp-server/tools/getAnnouncements.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/getAnnouncements.js +39 -1
- package/esm/src/mcp-server/tools/getAnnouncements.js.map +1 -1
- package/esm/src/mcp-server/tools/getArticle.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/getArticle.js +42 -0
- package/esm/src/mcp-server/tools/getArticle.js.map +1 -1
- package/esm/src/mcp-server/tools/getArticleById.d.ts +7 -0
- package/esm/src/mcp-server/tools/getArticleById.d.ts.map +1 -0
- package/esm/src/mcp-server/tools/getArticleById.js +90 -0
- package/esm/src/mcp-server/tools/getArticleById.js.map +1 -0
- package/esm/src/mcp-server/tools/getBestAnswer.d.ts +7 -0
- package/esm/src/mcp-server/tools/getBestAnswer.d.ts.map +1 -0
- package/esm/src/mcp-server/tools/getBestAnswer.js +85 -0
- package/esm/src/mcp-server/tools/getBestAnswer.js.map +1 -0
- package/esm/src/mcp-server/tools/getMyPortals.d.ts +7 -0
- package/esm/src/mcp-server/tools/getMyPortals.d.ts.map +1 -0
- package/esm/src/mcp-server/tools/getMyPortals.js +117 -0
- package/esm/src/mcp-server/tools/getMyPortals.js.map +1 -0
- package/esm/src/mcp-server/tools/getPopularArticles.d.ts +1 -1
- package/esm/src/mcp-server/tools/getPopularArticles.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/getPopularArticles.js +40 -0
- package/esm/src/mcp-server/tools/getPopularArticles.js.map +1 -1
- package/esm/src/mcp-server/tools/getPortals.d.ts +1 -1
- package/esm/src/mcp-server/tools/getPortals.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/getPortals.js +26 -1
- package/esm/src/mcp-server/tools/getPortals.js.map +1 -1
- package/esm/src/mcp-server/tools/makeSuggestion.d.ts +1 -1
- package/esm/src/mcp-server/tools/makeSuggestion.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/makeSuggestion.js +44 -0
- package/esm/src/mcp-server/tools/makeSuggestion.js.map +1 -1
- package/esm/src/mcp-server/tools/queryAnswers.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/queryAnswers.js +41 -5
- package/esm/src/mcp-server/tools/queryAnswers.js.map +1 -1
- package/esm/src/mcp-server/tools/queryRetrieve.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/queryRetrieve.js +41 -1
- package/esm/src/mcp-server/tools/queryRetrieve.js.map +1 -1
- package/esm/src/mcp-server/tools/querySearch.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/querySearch.js +48 -1
- package/esm/src/mcp-server/tools/querySearch.js.map +1 -1
- package/esm/src/mcp-server/tools/retrieveChunks.d.ts +1 -1
- package/esm/src/mcp-server/tools/retrieveChunks.d.ts.map +1 -1
- package/esm/src/mcp-server/tools/retrieveChunks.js +41 -7
- package/esm/src/mcp-server/tools/retrieveChunks.js.map +1 -1
- package/esm/src/mcp-server/tools.d.ts +14 -4
- package/esm/src/mcp-server/tools.d.ts.map +1 -1
- package/esm/src/mcp-server/tools.js +203 -5
- package/esm/src/mcp-server/tools.js.map +1 -1
- package/esm/src/models/acceptlanguage.d.ts +36 -5
- package/esm/src/models/acceptlanguage.d.ts.map +1 -1
- package/esm/src/models/acceptlanguage.js +18 -4
- package/esm/src/models/acceptlanguage.js.map +1 -1
- package/esm/src/models/accessibleportal.d.ts +1 -1
- package/esm/src/models/accessibleportal.d.ts.map +1 -1
- package/esm/src/models/accessibleportal.js.map +1 -1
- package/esm/src/models/additionalsnippets.d.ts +18 -3
- package/esm/src/models/additionalsnippets.d.ts.map +1 -1
- package/esm/src/models/additionalsnippets.js +8 -1
- package/esm/src/models/additionalsnippets.js.map +1 -1
- package/esm/src/models/aisearchop.d.ts +4 -10
- package/esm/src/models/aisearchop.d.ts.map +1 -1
- package/esm/src/models/aisearchop.js +9 -20
- package/esm/src/models/aisearchop.js.map +1 -1
- package/esm/src/models/aisearchresponse.d.ts +2 -2
- package/esm/src/models/aisearchresponse.d.ts.map +1 -1
- package/esm/src/models/aisearchresponse.js.map +1 -1
- package/esm/src/models/aispaginationinfo.d.ts +1 -1
- package/esm/src/models/aispaginationinfo.d.ts.map +1 -1
- package/esm/src/models/aispaginationinfo.js +5 -4
- package/esm/src/models/aispaginationinfo.js.map +1 -1
- package/esm/src/models/aitopicbreadcrumb.d.ts +1 -1
- package/esm/src/models/aitopicbreadcrumb.d.ts.map +1 -1
- package/esm/src/models/aitopicbreadcrumb.js +2 -1
- package/esm/src/models/aitopicbreadcrumb.js.map +1 -1
- package/esm/src/models/aitopicsummary.d.ts +1 -1
- package/esm/src/models/aitopicsummary.d.ts.map +1 -1
- package/esm/src/models/aitopicsummary.js.map +1 -1
- package/esm/src/models/allaccessibleportals.d.ts +1 -1
- package/esm/src/models/allaccessibleportals.d.ts.map +1 -1
- package/esm/src/models/allaccessibleportals.js +2 -1
- package/esm/src/models/allaccessibleportals.js.map +1 -1
- package/esm/src/models/answersrequest.d.ts +16 -25
- package/esm/src/models/answersrequest.d.ts.map +1 -1
- package/esm/src/models/answersrequest.js +11 -25
- package/esm/src/models/answersrequest.js.map +1 -1
- package/esm/src/models/answersresponse.d.ts +28 -7
- package/esm/src/models/answersresponse.d.ts.map +1 -1
- package/esm/src/models/answersresponse.js +8 -0
- package/esm/src/models/answersresponse.js.map +1 -1
- package/esm/src/models/article.d.ts +2 -2
- package/esm/src/models/article.d.ts.map +1 -1
- package/esm/src/models/article.js +3 -4
- package/esm/src/models/article.js.map +1 -1
- package/esm/src/models/articleadditionalattributes.d.ts +36 -2
- package/esm/src/models/articleadditionalattributes.d.ts.map +1 -1
- package/esm/src/models/articleadditionalattributes.js +17 -0
- package/esm/src/models/articleadditionalattributes.js.map +1 -1
- package/esm/src/models/articleaisearchresult.d.ts +48 -9
- package/esm/src/models/articleaisearchresult.d.ts.map +1 -1
- package/esm/src/models/articleaisearchresult.js +17 -1
- package/esm/src/models/articleaisearchresult.js.map +1 -1
- package/esm/src/models/articleattachment.d.ts +14 -3
- package/esm/src/models/articleattachment.d.ts.map +1 -1
- package/esm/src/models/articleattachment.js +7 -2
- package/esm/src/models/articleattachment.js.map +1 -1
- package/esm/src/models/articleresult.d.ts +1 -1
- package/esm/src/models/articleresult.d.ts.map +1 -1
- package/esm/src/models/articleresult.js +1 -1
- package/esm/src/models/articleresult.js.map +1 -1
- package/esm/src/models/articleresultadditionalattributes.d.ts +34 -2
- package/esm/src/models/articleresultadditionalattributes.d.ts.map +1 -1
- package/esm/src/models/articleresultadditionalattributes.js +16 -0
- package/esm/src/models/articleresultadditionalattributes.js.map +1 -1
- package/esm/src/models/articleresults.d.ts +1 -1
- package/esm/src/models/articleresults.d.ts.map +1 -1
- package/esm/src/models/articleresults.js.map +1 -1
- package/esm/src/models/articletype.d.ts +2 -7
- package/esm/src/models/articletype.d.ts.map +1 -1
- package/esm/src/models/articletype.js +2 -16
- package/esm/src/models/articletype.js.map +1 -1
- package/esm/src/models/attachmentforcreatesuggestion.d.ts +1 -1
- package/esm/src/models/attachmentforcreatesuggestion.d.ts.map +1 -1
- package/esm/src/models/attachmentforcreatesuggestion.js.map +1 -1
- package/esm/src/models/bookmarkstatus.d.ts +1 -1
- package/esm/src/models/bookmarkstatus.d.ts.map +1 -1
- package/esm/src/models/bookmarkstatus.js +1 -1
- package/esm/src/models/bookmarkstatus.js.map +1 -1
- package/esm/src/models/complianceforarticle.d.ts +3 -3
- package/esm/src/models/complianceforarticle.d.ts.map +1 -1
- package/esm/src/models/complianceforarticle.js +8 -5
- package/esm/src/models/complianceforarticle.js.map +1 -1
- package/esm/src/models/createdby.d.ts +1 -1
- package/esm/src/models/createdby.d.ts.map +1 -1
- package/esm/src/models/createdby.js.map +1 -1
- package/esm/src/models/createsuggestion.d.ts +69 -6
- package/esm/src/models/createsuggestion.d.ts.map +1 -1
- package/esm/src/models/createsuggestion.js +31 -2
- package/esm/src/models/createsuggestion.js.map +1 -1
- package/esm/src/models/customattribute.d.ts +18 -3
- package/esm/src/models/customattribute.d.ts.map +1 -1
- package/esm/src/models/customattribute.js +6 -0
- package/esm/src/models/customattribute.js.map +1 -1
- package/esm/src/models/department.d.ts +1 -1
- package/esm/src/models/department.d.ts.map +1 -1
- package/esm/src/models/department.js.map +1 -1
- package/esm/src/models/edition.d.ts +2 -2
- package/esm/src/models/edition.d.ts.map +1 -1
- package/esm/src/models/edition.js +1 -2
- package/esm/src/models/edition.js.map +1 -1
- package/esm/src/models/errors/sdkvalidationerror.d.ts +1 -1
- package/esm/src/models/errors/sdkvalidationerror.d.ts.map +1 -1
- package/esm/src/models/errors/sdkvalidationerror.js +2 -49
- package/esm/src/models/errors/sdkvalidationerror.js.map +1 -1
- package/esm/src/models/folderbreadcrumb.d.ts +1 -1
- package/esm/src/models/folderbreadcrumb.d.ts.map +1 -1
- package/esm/src/models/folderbreadcrumb.js.map +1 -1
- package/esm/src/models/foldersummary.d.ts +1 -1
- package/esm/src/models/foldersummary.d.ts.map +1 -1
- package/esm/src/models/foldersummary.js +1 -1
- package/esm/src/models/foldersummary.js.map +1 -1
- package/esm/src/models/getannouncementarticlesop.d.ts +8 -9
- package/esm/src/models/getannouncementarticlesop.d.ts.map +1 -1
- package/esm/src/models/getannouncementarticlesop.js +12 -10
- package/esm/src/models/getannouncementarticlesop.js.map +1 -1
- package/esm/src/models/getarticlebyidop.d.ts +77 -11
- package/esm/src/models/getarticlebyidop.d.ts.map +1 -1
- package/esm/src/models/getarticlebyidop.js +31 -62
- package/esm/src/models/getarticlebyidop.js.map +1 -1
- package/esm/src/models/getbestanswerop.d.ts +1 -9
- package/esm/src/models/getbestanswerop.d.ts.map +1 -1
- package/esm/src/models/getbestanswerop.js +3 -16
- package/esm/src/models/getbestanswerop.js.map +1 -1
- package/esm/src/models/getmyportalsop.d.ts +4 -10
- package/esm/src/models/getmyportalsop.d.ts.map +1 -1
- package/esm/src/models/getmyportalsop.js +9 -10
- package/esm/src/models/getmyportalsop.js.map +1 -1
- package/esm/src/models/getpopulararticlesop.d.ts +8 -9
- package/esm/src/models/getpopulararticlesop.d.ts.map +1 -1
- package/esm/src/models/getpopulararticlesop.js +12 -10
- package/esm/src/models/getpopulararticlesop.js.map +1 -1
- package/esm/src/models/l10nstring.d.ts +1 -1
- package/esm/src/models/l10nstring.d.ts.map +1 -1
- package/esm/src/models/l10nstring.js.map +1 -1
- package/esm/src/models/languagecode.d.ts +69 -2
- package/esm/src/models/languagecode.d.ts.map +1 -1
- package/esm/src/models/languagecode.js +32 -0
- package/esm/src/models/languagecode.js.map +1 -1
- package/esm/src/models/languagecodeparameter.d.ts +90 -5
- package/esm/src/models/languagecodeparameter.d.ts.map +1 -1
- package/esm/src/models/languagecodeparameter.js +45 -4
- package/esm/src/models/languagecodeparameter.js.map +1 -1
- package/esm/src/models/languagequeryparameter.d.ts +90 -5
- package/esm/src/models/languagequeryparameter.d.ts.map +1 -1
- package/esm/src/models/languagequeryparameter.js +45 -4
- package/esm/src/models/languagequeryparameter.js.map +1 -1
- package/esm/src/models/link.d.ts +1 -1
- package/esm/src/models/link.d.ts.map +1 -1
- package/esm/src/models/link.js.map +1 -1
- package/esm/src/models/makesuggestionop.d.ts +4 -9
- package/esm/src/models/makesuggestionop.d.ts.map +1 -1
- package/esm/src/models/makesuggestionop.js +3 -7
- package/esm/src/models/makesuggestionop.js.map +1 -1
- package/esm/src/models/mandatorylanguagequeryparameter.d.ts +90 -5
- package/esm/src/models/mandatorylanguagequeryparameter.d.ts.map +1 -1
- package/esm/src/models/mandatorylanguagequeryparameter.js +45 -4
- package/esm/src/models/mandatorylanguagequeryparameter.js.map +1 -1
- package/esm/src/models/milestone.d.ts +1 -1
- package/esm/src/models/milestone.d.ts.map +1 -1
- package/esm/src/models/milestone.js.map +1 -1
- package/esm/src/models/milestonename.d.ts +1 -1
- package/esm/src/models/milestonename.d.ts.map +1 -1
- package/esm/src/models/milestonename.js.map +1 -1
- package/esm/src/models/modifiedby.d.ts +1 -1
- package/esm/src/models/modifiedby.d.ts.map +1 -1
- package/esm/src/models/modifiedby.js.map +1 -1
- package/esm/src/models/order.d.ts +10 -2
- package/esm/src/models/order.d.ts.map +1 -1
- package/esm/src/models/order.js +4 -0
- package/esm/src/models/order.js.map +1 -1
- package/esm/src/models/ownedby.d.ts +1 -1
- package/esm/src/models/ownedby.d.ts.map +1 -1
- package/esm/src/models/ownedby.js +1 -2
- package/esm/src/models/ownedby.js.map +1 -1
- package/esm/src/models/paginationinfo.d.ts +1 -1
- package/esm/src/models/paginationinfo.d.ts.map +1 -1
- package/esm/src/models/paginationinfo.js +3 -3
- package/esm/src/models/paginationinfo.js.map +1 -1
- package/esm/src/models/personalization.d.ts +4 -4
- package/esm/src/models/personalization.d.ts.map +1 -1
- package/esm/src/models/personalization.js +1 -2
- package/esm/src/models/personalization.js.map +1 -1
- package/esm/src/models/publishview.d.ts +2 -2
- package/esm/src/models/publishview.d.ts.map +1 -1
- package/esm/src/models/publishview.js.map +1 -1
- package/esm/src/models/referenceresponse.d.ts +30 -5
- package/esm/src/models/referenceresponse.d.ts.map +1 -1
- package/esm/src/models/referenceresponse.js +12 -1
- package/esm/src/models/referenceresponse.js.map +1 -1
- package/esm/src/models/requiredlanguagecode.d.ts +71 -2
- package/esm/src/models/requiredlanguagecode.d.ts.map +1 -1
- package/esm/src/models/requiredlanguagecode.js +33 -0
- package/esm/src/models/requiredlanguagecode.js.map +1 -1
- package/esm/src/models/retrievechunksop.d.ts +1 -9
- package/esm/src/models/retrievechunksop.d.ts.map +1 -1
- package/esm/src/models/retrievechunksop.js +1 -15
- package/esm/src/models/retrievechunksop.js.map +1 -1
- package/esm/src/models/retrieverequest.d.ts +15 -4
- package/esm/src/models/retrieverequest.d.ts.map +1 -1
- package/esm/src/models/retrieverequest.js +4 -0
- package/esm/src/models/retrieverequest.js.map +1 -1
- package/esm/src/models/retrieveresponse.d.ts +27 -8
- package/esm/src/models/retrieveresponse.d.ts.map +1 -1
- package/esm/src/models/retrieveresponse.js +8 -1
- package/esm/src/models/retrieveresponse.js.map +1 -1
- package/esm/src/models/schemaslink.d.ts +1 -1
- package/esm/src/models/schemaslink.d.ts.map +1 -1
- package/esm/src/models/schemaslink.js.map +1 -1
- package/esm/src/models/schemastags.d.ts +1 -1
- package/esm/src/models/schemastags.d.ts.map +1 -1
- package/esm/src/models/schemastags.js.map +1 -1
- package/esm/src/models/searchresult.d.ts +40 -5
- package/esm/src/models/searchresult.d.ts.map +1 -1
- package/esm/src/models/searchresult.js +19 -0
- package/esm/src/models/searchresult.js.map +1 -1
- package/esm/src/models/security.d.ts +5 -2
- package/esm/src/models/security.d.ts.map +1 -1
- package/esm/src/models/security.js +5 -3
- package/esm/src/models/security.js.map +1 -1
- package/esm/src/models/shorturl.d.ts +1 -1
- package/esm/src/models/shorturl.d.ts.map +1 -1
- package/esm/src/models/shorturl.js +1 -2
- package/esm/src/models/shorturl.js.map +1 -1
- package/esm/src/models/sortidnamedepartment.d.ts +12 -2
- package/esm/src/models/sortidnamedepartment.d.ts.map +1 -1
- package/esm/src/models/sortidnamedepartment.js +5 -0
- package/esm/src/models/sortidnamedepartment.js.map +1 -1
- package/esm/src/models/stage.d.ts +1 -1
- package/esm/src/models/stage.d.ts.map +1 -1
- package/esm/src/models/stage.js +1 -2
- package/esm/src/models/stage.js.map +1 -1
- package/esm/src/models/structuredauthoringfields.d.ts +1 -1
- package/esm/src/models/structuredauthoringfields.d.ts.map +1 -1
- package/esm/src/models/structuredauthoringfields.js.map +1 -1
- package/esm/src/models/tag.d.ts +1 -1
- package/esm/src/models/tag.d.ts.map +1 -1
- package/esm/src/models/tag.js.map +1 -1
- package/esm/src/models/tagcategory.d.ts +1 -1
- package/esm/src/models/tagcategory.d.ts.map +1 -1
- package/esm/src/models/tagcategory.js.map +1 -1
- package/esm/src/models/taggroup.d.ts +1 -1
- package/esm/src/models/taggroup.d.ts.map +1 -1
- package/esm/src/models/taggroup.js +1 -2
- package/esm/src/models/taggroup.js.map +1 -1
- package/esm/src/models/taggroups.d.ts +1 -1
- package/esm/src/models/taggroups.d.ts.map +1 -1
- package/esm/src/models/taggroups.js.map +1 -1
- package/esm/src/models/tags.d.ts +1 -1
- package/esm/src/models/tags.d.ts.map +1 -1
- package/esm/src/models/tags.js.map +1 -1
- package/esm/src/models/topicbreadcrumb.d.ts +1 -1
- package/esm/src/models/topicbreadcrumb.d.ts.map +1 -1
- package/esm/src/models/topicbreadcrumb.js.map +1 -1
- package/esm/src/models/topicsummary.d.ts +1 -1
- package/esm/src/models/topicsummary.d.ts.map +1 -1
- package/esm/src/models/topicsummary.js.map +1 -1
- package/esm/src/models/workflow.d.ts +1 -1
- package/esm/src/models/workflow.d.ts.map +1 -1
- package/esm/src/models/workflow.js +1 -2
- package/esm/src/models/workflow.js.map +1 -1
- package/esm/src/models/workflowmilestone.d.ts +12 -2
- package/esm/src/models/workflowmilestone.d.ts.map +1 -1
- package/esm/src/models/workflowmilestone.js +5 -0
- package/esm/src/models/workflowmilestone.js.map +1 -1
- package/esm/src/models/wserrorcommon.d.ts +2 -2
- package/esm/src/models/wserrorcommon.d.ts.map +1 -1
- package/esm/src/models/wserrorcommon.js +1 -2
- package/esm/src/models/wserrorcommon.js.map +1 -1
- package/esm/src/tool-names.d.ts +5 -0
- package/esm/src/tool-names.d.ts.map +1 -0
- package/esm/src/tool-names.js +36 -0
- package/esm/src/tool-names.js.map +1 -0
- package/esm/src/types/bigint.d.ts +6 -0
- package/esm/src/types/bigint.d.ts.map +1 -0
- package/esm/src/types/bigint.js +87 -0
- package/esm/src/types/bigint.js.map +1 -0
- package/esm/worker-configuration.d.ts +1 -0
- package/esm/worker-configuration.d.ts.map +1 -1
- package/manifest.json +78 -51
- package/package.json +11 -7
- package/src/cloudflare-worker/cloudflare-worker.ts +22 -9
- package/src/funcs/{querySearch.ts → aiSearch.ts} +49 -2
- package/src/funcs/{getAnnouncements.ts → getAnnouncementArticles.ts} +67 -10
- package/src/funcs/{getArticle.ts → getArticleById.ts} +58 -1
- package/src/funcs/{queryAnswers.ts → getBestAnswer.ts} +52 -14
- package/src/funcs/{getPortals.ts → getMyPortals.ts} +35 -2
- package/src/funcs/getPopularArticles.ts +68 -8
- package/src/funcs/makeSuggestion.ts +67 -9
- package/src/funcs/{queryRetrieve.ts → retrieveChunks.ts} +50 -15
- package/src/hooks/auth-hook.ts +3 -63
- package/src/hooks/registration.ts +3 -18
- package/src/landing-page.ts +1084 -0
- package/src/lib/base64.ts +2 -2
- package/src/lib/config.ts +5 -5
- package/src/lib/encodings.ts +12 -3
- package/src/lib/matchers.ts +5 -1
- package/src/lib/schemas.ts +10 -22
- package/src/lib/sdks.ts +2 -2
- package/src/lib/security.ts +21 -0
- package/src/mcp-server/cli/start/command.ts +31 -0
- package/src/mcp-server/cli/start/impl.ts +118 -31
- package/src/mcp-server/extensions.ts +6 -4
- package/src/mcp-server/flags.ts +21 -0
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/prompts.ts +9 -19
- package/src/mcp-server/server.ts +22 -16
- package/src/mcp-server/tools/aiSearch.ts +92 -0
- package/src/mcp-server/tools/getAnnouncementArticles.ts +90 -0
- package/src/mcp-server/tools/getArticleById.ts +99 -0
- package/src/mcp-server/tools/getBestAnswer.ts +94 -0
- package/src/mcp-server/tools/{getPortals.ts → getMyPortals.ts} +39 -5
- package/src/mcp-server/tools/getPopularArticles.ts +40 -0
- package/src/mcp-server/tools/makeSuggestion.ts +44 -0
- package/src/mcp-server/tools/retrieveChunks.ts +89 -0
- package/src/mcp-server/tools.ts +300 -46
- package/src/models/acceptlanguage.ts +21 -8
- package/src/models/accessibleportal.ts +9 -11
- package/src/models/additionalsnippets.ts +25 -18
- package/src/models/aisearchop.ts +14 -37
- package/src/models/aisearchresponse.ts +7 -13
- package/src/models/aispaginationinfo.ts +7 -10
- package/src/models/aitopicbreadcrumb.ts +4 -7
- package/src/models/aitopicsummary.ts +1 -5
- package/src/models/allaccessibleportals.ts +5 -8
- package/src/models/answersrequest.ts +22 -58
- package/src/models/answersresponse.ts +30 -24
- package/src/models/article.ts +39 -40
- package/src/models/articleadditionalattributes.ts +22 -4
- package/src/models/articleaisearchresult.ts +70 -52
- package/src/models/articleattachment.ts +18 -15
- package/src/models/articleresult.ts +2 -6
- package/src/models/articleresultadditionalattributes.ts +43 -0
- package/src/models/articleresults.ts +1 -5
- package/src/models/articletype.ts +4 -25
- package/src/models/attachmentforcreatesuggestion.ts +1 -3
- package/src/models/bookmarkstatus.ts +2 -6
- package/src/models/complianceforarticle.ts +13 -22
- package/src/models/createdby.ts +7 -8
- package/src/models/createsuggestion.ts +54 -31
- package/src/models/customattribute.ts +13 -7
- package/src/models/department.ts +1 -5
- package/src/models/edition.ts +8 -13
- package/src/models/errors/sdkvalidationerror.ts +2 -57
- package/src/models/folderbreadcrumb.ts +5 -7
- package/src/models/foldersummary.ts +2 -6
- package/src/models/getannouncementarticlesop.ts +34 -23
- package/src/models/getarticlebyidop.ts +91 -95
- package/src/models/getbestanswerop.ts +16 -48
- package/src/models/getmyportalsop.ts +29 -44
- package/src/models/getpopulararticlesop.ts +34 -23
- package/src/models/l10nstring.ts +1 -5
- package/src/models/languagecode.ts +38 -2
- package/src/models/languagecodeparameter.ts +48 -10
- package/src/models/languagequeryparameter.ts +48 -10
- package/src/models/link.ts +1 -1
- package/src/models/makesuggestionop.ts +20 -30
- package/src/models/mandatorylanguagequeryparameter.ts +50 -10
- package/src/models/milestone.ts +3 -4
- package/src/models/milestonename.ts +1 -5
- package/src/models/modifiedby.ts +1 -5
- package/src/models/order.ts +7 -2
- package/src/models/ownedby.ts +7 -8
- package/src/models/paginationinfo.ts +4 -8
- package/src/models/personalization.ts +6 -19
- package/src/models/publishview.ts +2 -8
- package/src/models/referenceresponse.ts +34 -20
- package/src/models/requiredlanguagecode.ts +39 -4
- package/src/models/retrievechunksop.ts +16 -48
- package/src/models/retrieverequest.ts +12 -10
- package/src/models/retrieveresponse.ts +34 -28
- package/src/models/schemaslink.ts +1 -5
- package/src/models/schemastags.ts +1 -5
- package/src/models/searchresult.ts +34 -8
- package/src/models/security.ts +14 -7
- package/src/models/shorturl.ts +6 -7
- package/src/models/sortidnamedepartment.ts +8 -4
- package/src/models/stage.ts +4 -5
- package/src/models/structuredauthoringfields.ts +1 -3
- package/src/models/tag.ts +1 -1
- package/src/models/tagcategory.ts +1 -5
- package/src/models/taggroup.ts +4 -5
- package/src/models/taggroups.ts +3 -4
- package/src/models/tags.ts +1 -1
- package/src/models/topicbreadcrumb.ts +1 -5
- package/src/models/topicsummary.ts +1 -5
- package/src/models/workflow.ts +3 -4
- package/src/models/workflowmilestone.ts +8 -2
- package/src/models/wserrorcommon.ts +5 -10
- package/src/tool-names.ts +35 -0
- package/src/types/bigint.ts +87 -0
- package/tsconfig.json +0 -1
- package/worker-configuration.d.ts +2 -2
- package/worker-configuration.ts +1 -0
- package/src/cloudflare-worker/landing-page.ts +0 -337
- package/src/hooks/portal-cache-hook.ts +0 -505
- package/src/hooks/portal-lookup-hook.ts +0 -429
- package/src/mcp-server/tools/getAnnouncements.ts +0 -53
- package/src/mcp-server/tools/getArticle.ts +0 -56
- package/src/mcp-server/tools/queryAnswers.ts +0 -57
- package/src/mcp-server/tools/queryRetrieve.ts +0 -55
- package/src/mcp-server/tools/querySearch.ts +0 -44
|
@@ -1,429 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Portal Lookup Hook for eGain MCP Server
|
|
3
|
-
* Translates portal names to portal IDs in request parameters before sending requests
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { BeforeRequestHook, BeforeRequestContext } from "./types.js";
|
|
7
|
-
import { PortalCacheHook } from "./portal-cache-hook.js";
|
|
8
|
-
|
|
9
|
-
export class PortalLookupHook implements BeforeRequestHook {
|
|
10
|
-
constructor(private portalCache: PortalCacheHook) {}
|
|
11
|
-
|
|
12
|
-
private translatePortalName(portalName: string): string | null {
|
|
13
|
-
// Skip if it's already a numeric ID
|
|
14
|
-
if (/^\d+$/.test(portalName)) {
|
|
15
|
-
return null; // Already an ID, no translation needed
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Check cache readiness using the same logic as beforeCreateRequest
|
|
19
|
-
const availablePortals = this.portalCache.getAvailablePortals();
|
|
20
|
-
const cacheInitialized = this.portalCache.isCacheInitialized();
|
|
21
|
-
const cacheReady = cacheInitialized || availablePortals.length > 0;
|
|
22
|
-
|
|
23
|
-
if (!cacheReady) {
|
|
24
|
-
const isInitializing = this.portalCache.isCacheInitializing();
|
|
25
|
-
if (isInitializing) {
|
|
26
|
-
console.error(`⚠️ LOOKUP: Portal cache still initializing, cannot translate portal name: "${portalName}"`);
|
|
27
|
-
console.error('💡 LOOKUP: Race condition detected - cache initialization in progress');
|
|
28
|
-
} else {
|
|
29
|
-
console.error(`⚠️ LOOKUP: Portal cache not ready, cannot translate portal name: "${portalName}"`);
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Try exact match first
|
|
35
|
-
let portalId = this.portalCache.getPortalId(portalName);
|
|
36
|
-
|
|
37
|
-
if (portalId) {
|
|
38
|
-
console.error(`✅ LOOKUP: Exact match found "${portalName}" -> "${portalId}"`);
|
|
39
|
-
return portalId;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Try fuzzy matching if exact match fails
|
|
43
|
-
portalId = this.fuzzyMatchPortal(portalName, availablePortals);
|
|
44
|
-
|
|
45
|
-
if (portalId) {
|
|
46
|
-
console.error(`✅ LOOKUP: Fuzzy match found for "${portalName}" -> "${portalId}"`);
|
|
47
|
-
} else {
|
|
48
|
-
console.error(`⚠️ LOOKUP: Portal name "${portalName}" not found in cache. Available portals:`,
|
|
49
|
-
availablePortals.map(p => p.name).join(', '));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return portalId;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
private fuzzyMatchPortal(searchName: string, availablePortals: Array<{id: string, name: string}>): string | null {
|
|
56
|
-
const normalizedSearch = searchName.toLowerCase().trim();
|
|
57
|
-
|
|
58
|
-
// Remove common suffixes/prefixes that might differ
|
|
59
|
-
const cleanSearch = normalizedSearch
|
|
60
|
-
.replace(/\s*portal\s*$/i, '')
|
|
61
|
-
.replace(/^portal\s*/i, '')
|
|
62
|
-
.trim();
|
|
63
|
-
|
|
64
|
-
for (const portal of availablePortals) {
|
|
65
|
-
const normalizedPortal = portal.name.toLowerCase().trim();
|
|
66
|
-
const cleanPortal = normalizedPortal
|
|
67
|
-
.replace(/\s*portal\s*$/i, '')
|
|
68
|
-
.replace(/^portal\s*/i, '')
|
|
69
|
-
.trim();
|
|
70
|
-
|
|
71
|
-
// Try various matching strategies
|
|
72
|
-
if (
|
|
73
|
-
// Exact match after cleaning
|
|
74
|
-
cleanSearch === cleanPortal ||
|
|
75
|
-
// Contains match (search contains portal name or vice versa)
|
|
76
|
-
cleanSearch.includes(cleanPortal) ||
|
|
77
|
-
cleanPortal.includes(cleanSearch) ||
|
|
78
|
-
// Partial word match
|
|
79
|
-
this.wordsMatch(cleanSearch, cleanPortal)
|
|
80
|
-
) {
|
|
81
|
-
console.error(`🎯 LOOKUP: Fuzzy matched "${searchName}" -> "${portal.name}" (${portal.id})`);
|
|
82
|
-
return portal.id;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private wordsMatch(search: string, target: string): boolean {
|
|
90
|
-
const searchWords = search.split(/\s+/).filter(w => w.length > 2);
|
|
91
|
-
const targetWords = target.split(/\s+/).filter(w => w.length > 2);
|
|
92
|
-
|
|
93
|
-
// If either has significant words, check if any match
|
|
94
|
-
if (searchWords.length > 0 && targetWords.length > 0) {
|
|
95
|
-
return searchWords.some(sw =>
|
|
96
|
-
targetWords.some(tw =>
|
|
97
|
-
sw.includes(tw) || tw.includes(sw)
|
|
98
|
-
)
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Get default portal ID (only from cache, no hard-coded fallbacks)
|
|
106
|
-
private getDefaultPortalId(): string | null {
|
|
107
|
-
// Try common default portal names from cache only
|
|
108
|
-
const defaultPortalNames = ['Master Portal'];
|
|
109
|
-
|
|
110
|
-
for (const defaultName of defaultPortalNames) {
|
|
111
|
-
const portalId = this.translatePortalName(defaultName);
|
|
112
|
-
if (portalId) {
|
|
113
|
-
console.error(`🎯 LOOKUP: Using default portal "${defaultName}" -> ${portalId}`);
|
|
114
|
-
return portalId;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
console.error('⚠️ LOOKUP: No default portal found in cache');
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Get portal name from ID (reverse lookup)
|
|
123
|
-
private getPortalNameFromId(portalId: string): string | null {
|
|
124
|
-
const availablePortals = this.portalCache.getAvailablePortals();
|
|
125
|
-
for (const portal of availablePortals) {
|
|
126
|
-
if (portal.id === portalId) {
|
|
127
|
-
return portal.name;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
async beforeRequest(_hookCtx: BeforeRequestContext, request: Request): Promise<Request> {
|
|
136
|
-
// console.error('🔍 LOOKUP: ===== PORTAL LOOKUP HOOK TRIGGERED =====');
|
|
137
|
-
// console.error('🔍 LOOKUP: Request URL:', request.url);
|
|
138
|
-
// console.error('🔍 LOOKUP: Request method:', request.method);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
// Check if cache is ready (should be ready from SDKInit)
|
|
142
|
-
|
|
143
|
-
// Check if URL contains portal name in path (e.g., /portals/{portalName}/)
|
|
144
|
-
const urlObj = new URL(request.url);
|
|
145
|
-
// console.error('🔍 LOOKUP: Full URL:', request.url);
|
|
146
|
-
// console.error('🔍 LOOKUP: URL pathname:', urlObj.pathname);
|
|
147
|
-
// console.error('🔍 LOOKUP: Testing regex /\\/portals\\/([^\\/]+)/ against pathname...');
|
|
148
|
-
|
|
149
|
-
const portalPathMatch = urlObj.pathname.match(/\/portals\/([^\/]+)/);
|
|
150
|
-
// console.error('🔍 LOOKUP: Regex match result:', portalPathMatch);
|
|
151
|
-
|
|
152
|
-
if (portalPathMatch && portalPathMatch[1]) {
|
|
153
|
-
const portalNameInPath = portalPathMatch[1];
|
|
154
|
-
|
|
155
|
-
// Check if it's already a proper portal ID
|
|
156
|
-
const portalIdPattern = /^[a-zA-Z0-9]{2,4}-\d{4,15}$/;
|
|
157
|
-
if (!portalIdPattern.test(portalNameInPath)) {
|
|
158
|
-
console.error(`🔍 LOOKUP: Portal name "${portalNameInPath}" in URL path needs translation...`);
|
|
159
|
-
|
|
160
|
-
// Get cache info
|
|
161
|
-
const availablePortals = this.portalCache.getAvailablePortals();
|
|
162
|
-
const cacheInitialized = this.portalCache.isCacheInitialized();
|
|
163
|
-
const cacheReady = cacheInitialized || availablePortals.length > 0;
|
|
164
|
-
|
|
165
|
-
if (!cacheReady) {
|
|
166
|
-
console.error(`⚠️ LOOKUP: Cache not ready, cannot translate portal name "${portalNameInPath}" from URL path`);
|
|
167
|
-
// Don't return here - let it continue to wait for cache initialization
|
|
168
|
-
} else {
|
|
169
|
-
const translatedPortalId = this.translatePortalName(portalNameInPath);
|
|
170
|
-
if (translatedPortalId) {
|
|
171
|
-
console.error(`🔄 LOOKUP: SUCCESS! Translating URL path: "${portalNameInPath}" -> "${translatedPortalId}"`);
|
|
172
|
-
|
|
173
|
-
// Replace portal name in URL path with portal ID
|
|
174
|
-
const newPathname = urlObj.pathname.replace(`/portals/${portalNameInPath}`, `/portals/${translatedPortalId}`);
|
|
175
|
-
urlObj.pathname = newPathname;
|
|
176
|
-
|
|
177
|
-
console.error(`🔄 LOOKUP: Original URL: ${request.url}`);
|
|
178
|
-
console.error(`🔄 LOOKUP: Modified URL: ${urlObj.toString()}`);
|
|
179
|
-
|
|
180
|
-
// Create new request with modified URL
|
|
181
|
-
const newRequest = new Request(urlObj.toString(), {
|
|
182
|
-
method: request.method,
|
|
183
|
-
headers: request.headers,
|
|
184
|
-
body: request.body
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
console.error(`🔄 LOOKUP: ===== RETURNING MODIFIED REQUEST (URL PATH) =====`);
|
|
188
|
-
return newRequest;
|
|
189
|
-
} else {
|
|
190
|
-
console.error(`❌ LOOKUP: Failed to translate portal name "${portalNameInPath}" from URL path`);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
} else {
|
|
194
|
-
console.error(`✅ LOOKUP: Portal ID "${portalNameInPath}" in URL path already in correct format`);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// If cache is initializing, wait for it to complete
|
|
199
|
-
if (this.portalCache.isCacheInitializing()) {
|
|
200
|
-
console.error('⏳ LOOKUP: Cache is initializing, waiting for completion...');
|
|
201
|
-
await this.portalCache.waitForCacheInitialization();
|
|
202
|
-
console.error('✅ LOOKUP: Cache initialization completed');
|
|
203
|
-
|
|
204
|
-
// Re-check URL translation now that cache is ready
|
|
205
|
-
const portalPathMatch = urlObj.pathname.match(/\/portals\/([^\/]+)/);
|
|
206
|
-
if (portalPathMatch && portalPathMatch[1]) {
|
|
207
|
-
const portalNameInPath = portalPathMatch[1];
|
|
208
|
-
const portalIdPattern = /^[a-zA-Z0-9]{2,4}-\d{4,15}$/;
|
|
209
|
-
|
|
210
|
-
if (!portalIdPattern.test(portalNameInPath)) {
|
|
211
|
-
console.error(`🔄 LOOKUP: Re-checking URL translation after cache initialization for: "${portalNameInPath}"`);
|
|
212
|
-
|
|
213
|
-
const translatedPortalId = this.translatePortalName(portalNameInPath);
|
|
214
|
-
if (translatedPortalId) {
|
|
215
|
-
console.error(`🔄 LOOKUP: SUCCESS! Post-cache translating URL path: "${portalNameInPath}" -> "${translatedPortalId}"`);
|
|
216
|
-
|
|
217
|
-
// Replace portal name in URL path with portal ID
|
|
218
|
-
const newPathname = urlObj.pathname.replace(`/portals/${portalNameInPath}`, `/portals/${translatedPortalId}`);
|
|
219
|
-
urlObj.pathname = newPathname;
|
|
220
|
-
|
|
221
|
-
console.error(`🔄 LOOKUP: Original URL: ${request.url}`);
|
|
222
|
-
console.error(`🔄 LOOKUP: Modified URL: ${urlObj.toString()}`);
|
|
223
|
-
|
|
224
|
-
// Create new request with modified URL
|
|
225
|
-
const newRequest = new Request(urlObj.toString(), {
|
|
226
|
-
method: request.method,
|
|
227
|
-
headers: request.headers,
|
|
228
|
-
body: request.body
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
// console.error(`🔄 LOOKUP: ===== RETURNING MODIFIED REQUEST (POST-CACHE) =====`);
|
|
232
|
-
return newRequest;
|
|
233
|
-
} else {
|
|
234
|
-
console.error(`❌ LOOKUP: Post-cache translation failed for portal name "${portalNameInPath}"`);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
const availablePortals = this.portalCache.getAvailablePortals();
|
|
241
|
-
const cacheReady = this.portalCache.isCacheInitialized() || availablePortals.length > 0;
|
|
242
|
-
|
|
243
|
-
if (!cacheReady) {
|
|
244
|
-
console.error('⚠️ LOOKUP: Portal cache not ready, using fallback behavior');
|
|
245
|
-
console.error('💡 LOOKUP: Will use portalId as-is and attempt minimal translation');
|
|
246
|
-
// Don't return early - try to do what we can with the request
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
console.error(`📂 LOOKUP: Portal cache ready with ${availablePortals.length} portals, proceeding with translation`);
|
|
250
|
-
|
|
251
|
-
// Process request body for portal name translation
|
|
252
|
-
if (request.headers.get('content-type')?.includes('application/json')) {
|
|
253
|
-
try {
|
|
254
|
-
// Clone the request to avoid "already used" error
|
|
255
|
-
const clonedRequest = request.clone();
|
|
256
|
-
const body = await clonedRequest.text();
|
|
257
|
-
if (body.trim().startsWith('{') || body.trim().startsWith('[')) {
|
|
258
|
-
const parsedJson = JSON.parse(body);
|
|
259
|
-
let bodyModified = false;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
// Check for both portalID (uppercase D) and portalId (lowercase d)
|
|
263
|
-
const currentPortalId = parsedJson.portalID || parsedJson.portalId;
|
|
264
|
-
|
|
265
|
-
// Log current portal lookup context
|
|
266
|
-
if (parsedJson.channel && parsedJson.channel.name) {
|
|
267
|
-
console.error(`🎯 LOOKUP: Portal name detected in channel.name: "${parsedJson.channel.name}"`);
|
|
268
|
-
} else if (parsedJson.channel && parsedJson.channel.type === 'portal') {
|
|
269
|
-
console.error(`⚠️ LOOKUP: Channel type is "portal" but no channel.name provided for lookup`);
|
|
270
|
-
} else {
|
|
271
|
-
console.error(`📋 LOOKUP: No portal name in channel.name, will use portalID as-is: ${currentPortalId}`);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// Process portal_name in JSON body
|
|
275
|
-
if (parsedJson.portal_name && typeof parsedJson.portal_name === 'string') {
|
|
276
|
-
const portalId = this.translatePortalName(parsedJson.portal_name);
|
|
277
|
-
if (portalId) {
|
|
278
|
-
console.error(`🔄 LOOKUP: Translated JSON field portal_name: "${parsedJson.portal_name}" -> portal_id: "${portalId}"`);
|
|
279
|
-
parsedJson.portal_id = portalId;
|
|
280
|
-
delete parsedJson.portal_name;
|
|
281
|
-
bodyModified = true;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// Process portalID field (MCP tools use uppercase D)
|
|
286
|
-
|
|
287
|
-
if (parsedJson.portalID && typeof parsedJson.portalID === 'string') {
|
|
288
|
-
|
|
289
|
-
// Check if portalID doesn't match the expected pattern (prefix-digits)
|
|
290
|
-
const portalIdPattern = /^[a-zA-Z0-9]{2,4}-\d{4,15}$/;
|
|
291
|
-
const patternMatches = portalIdPattern.test(parsedJson.portalID);
|
|
292
|
-
|
|
293
|
-
if (!patternMatches) {
|
|
294
|
-
|
|
295
|
-
const translatedPortalId = this.translatePortalName(parsedJson.portalID);
|
|
296
|
-
console.error(`🔍 LOOKUP: Translation result: "${translatedPortalId}"`);
|
|
297
|
-
|
|
298
|
-
if (translatedPortalId) {
|
|
299
|
-
console.error(`🔄 LOOKUP: SUCCESS! Translated portalID: "${parsedJson.portalID}" -> "${translatedPortalId}"`);
|
|
300
|
-
console.error(`🔄 LOOKUP: BEFORE assignment - parsedJson.portalID = "${parsedJson.portalID}"`);
|
|
301
|
-
parsedJson.portalID = translatedPortalId;
|
|
302
|
-
console.error(`🔄 LOOKUP: AFTER assignment - parsedJson.portalID = "${parsedJson.portalID}"`);
|
|
303
|
-
bodyModified = true;
|
|
304
|
-
console.error(`🔄 LOOKUP: bodyModified set to: ${bodyModified}`);
|
|
305
|
-
} else {
|
|
306
|
-
console.error(`❌ LOOKUP: Failed to translate portalID "${parsedJson.portalID}". Available portals: ${availablePortals.map(p => p.name).slice(0, 5).join(', ')}${availablePortals.length > 5 ? '...' : ''}`);
|
|
307
|
-
}
|
|
308
|
-
} else {
|
|
309
|
-
console.error(`✅ LOOKUP: portalID "${parsedJson.portalID}" already in correct format, no translation needed`);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// Process portalId field (lowercase d for compatibility)
|
|
314
|
-
if (parsedJson.portalId && typeof parsedJson.portalId === 'string') {
|
|
315
|
-
// Check if portalId doesn't match the expected pattern (prefix-digits)
|
|
316
|
-
const portalIdPattern = /^[a-zA-Z0-9]{2,4}-\d{4,15}$/;
|
|
317
|
-
if (!portalIdPattern.test(parsedJson.portalId)) {
|
|
318
|
-
console.error(`🔍 LOOKUP: portalId "${parsedJson.portalId}" doesn't match expected pattern, attempting translation...`);
|
|
319
|
-
const translatedPortalId = this.translatePortalName(parsedJson.portalId);
|
|
320
|
-
if (translatedPortalId) {
|
|
321
|
-
console.error(`🔄 LOOKUP: Translated portalId: "${parsedJson.portalId}" -> "${translatedPortalId}"`);
|
|
322
|
-
parsedJson.portalId = translatedPortalId;
|
|
323
|
-
bodyModified = true;
|
|
324
|
-
} else {
|
|
325
|
-
console.error(`❌ LOOKUP: Failed to translate portalId "${parsedJson.portalId}". Available portals: ${availablePortals.map(p => p.name).slice(0, 5).join(', ')}${availablePortals.length > 5 ? '...' : ''}`);
|
|
326
|
-
}
|
|
327
|
-
} else {
|
|
328
|
-
console.error(`✅ LOOKUP: portalId "${parsedJson.portalId}" already in correct format, no translation needed`);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// Process channel.name in JSON body (for eGain requests)
|
|
333
|
-
if (parsedJson.channel &&
|
|
334
|
-
typeof parsedJson.channel === 'object' &&
|
|
335
|
-
parsedJson.channel.name &&
|
|
336
|
-
typeof parsedJson.channel.name === 'string') {
|
|
337
|
-
const portalId = this.translatePortalName(parsedJson.channel.name);
|
|
338
|
-
if (portalId) {
|
|
339
|
-
console.error(`🔄 LOOKUP: Translated JSON field channel.name: "${parsedJson.channel.name}" -> portalId: "${portalId}"`);
|
|
340
|
-
parsedJson.portalId = portalId;
|
|
341
|
-
bodyModified = true;
|
|
342
|
-
} else {
|
|
343
|
-
console.error(`❌ LOOKUP: Failed to translate portal name "${parsedJson.channel.name}". Available portals: ${availablePortals.map(p => p.name).slice(0, 5).join(', ')}${availablePortals.length > 5 ? '...' : ''}`);
|
|
344
|
-
console.error(`💡 LOOKUP: Make sure the portal name matches exactly or use fuzzy matching patterns`);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// Process portalId if it's 1 (default/placeholder) and we have channel info
|
|
349
|
-
if (parsedJson.portalId === 1 &&
|
|
350
|
-
parsedJson.channel &&
|
|
351
|
-
typeof parsedJson.channel === 'object' &&
|
|
352
|
-
parsedJson.channel.name &&
|
|
353
|
-
typeof parsedJson.channel.name === 'string') {
|
|
354
|
-
const portalId = this.translatePortalName(parsedJson.channel.name);
|
|
355
|
-
if (portalId) {
|
|
356
|
-
console.error(`🔄 LOOKUP: Replaced default portalId: 1 with "${parsedJson.channel.name}" -> portalId: "${portalId}"`);
|
|
357
|
-
parsedJson.portalId = portalId;
|
|
358
|
-
bodyModified = true;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// Handle case where channel.type is "portal" but no channel.name is provided
|
|
363
|
-
if (parsedJson.portalId === 1 &&
|
|
364
|
-
parsedJson.channel &&
|
|
365
|
-
typeof parsedJson.channel === 'object' &&
|
|
366
|
-
parsedJson.channel.type === 'portal' &&
|
|
367
|
-
!parsedJson.channel.name) {
|
|
368
|
-
console.error('⚠️ LOOKUP: Portal type="portal" specified but no channel.name provided for lookup');
|
|
369
|
-
if (cacheReady) {
|
|
370
|
-
// Try to get a default portal from cache
|
|
371
|
-
const portalId = this.getDefaultPortalId();
|
|
372
|
-
if (portalId) {
|
|
373
|
-
const portalName = this.getPortalNameFromId(portalId) || 'Default Portal';
|
|
374
|
-
console.error(`🔄 LOOKUP: No portal name provided, using default portal: "${portalName}" -> portalId: "${portalId}"`);
|
|
375
|
-
parsedJson.portalId = portalId;
|
|
376
|
-
// Also set the channel name for clarity
|
|
377
|
-
parsedJson.channel.name = portalName;
|
|
378
|
-
bodyModified = true;
|
|
379
|
-
} else {
|
|
380
|
-
console.error('❌ LOOKUP: No portal name provided and no default portal available in cache');
|
|
381
|
-
console.error('💡 LOOKUP: Please specify channel.name with a valid portal name (e.g., "eBrain")');
|
|
382
|
-
}
|
|
383
|
-
} else {
|
|
384
|
-
// Cache not ready - cannot proceed without cache
|
|
385
|
-
console.error('❌ LOOKUP: Cache not ready and no default portal available');
|
|
386
|
-
console.error('💡 LOOKUP: Portal cache must be initialized before making requests');
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// Handle case where portalId is a placeholder value (like 100) that needs translation
|
|
391
|
-
if ((parsedJson.portalId === 100 || parsedJson.portalId === 1) &&
|
|
392
|
-
parsedJson.channel &&
|
|
393
|
-
typeof parsedJson.channel === 'object' &&
|
|
394
|
-
parsedJson.channel.type === 'portal' &&
|
|
395
|
-
!cacheReady) {
|
|
396
|
-
console.error('❌ LOOKUP: Cache not ready and portalId needs translation - cannot proceed without cache');
|
|
397
|
-
console.error('💡 LOOKUP: Please ensure portal cache is initialized before making requests');
|
|
398
|
-
// Don't use hardcoded fallbacks - let the request fail properly
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
if (bodyModified) {
|
|
402
|
-
const newBody = JSON.stringify(parsedJson);
|
|
403
|
-
// console.error(`🔄 LOOKUP: ===== REQUEST BODY MODIFIED =====`);
|
|
404
|
-
// console.error(`🔄 LOOKUP: Original body: ${body}`);
|
|
405
|
-
// console.error(`🔄 LOOKUP: Modified body: ${newBody}`);
|
|
406
|
-
// console.error(`🔄 LOOKUP: Creating new request with modified body...`);
|
|
407
|
-
|
|
408
|
-
const newRequest = new Request(request.url, {
|
|
409
|
-
method: request.method,
|
|
410
|
-
headers: request.headers,
|
|
411
|
-
body: newBody
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
console.error(`🔄 LOOKUP: ===== RETURNING MODIFIED REQUEST =====`);
|
|
415
|
-
return newRequest;
|
|
416
|
-
} else {
|
|
417
|
-
// console.error(`🔄 LOOKUP: No modifications made to request body`);
|
|
418
|
-
// console.error('⚠️ Request body NOT modified. Final request will use original portalId:', parsedJson.portalId || parsedJson.portalID);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
} catch (error) {
|
|
422
|
-
console.error('Failed to parse JSON body for portal translation:', error);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
console.error(`🔄 LOOKUP: ===== RETURNING ORIGINAL REQUEST =====`);
|
|
427
|
-
return request;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { getAnnouncements } from "../../funcs/getAnnouncements.js";
|
|
6
|
-
import { GetAnnouncementArticlesRequest$zodSchema } from "../../models/getannouncementarticlesop.js";
|
|
7
|
-
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
-
|
|
9
|
-
const args = {
|
|
10
|
-
request: GetAnnouncementArticlesRequest$zodSchema,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const tool$getAnnouncements: ToolDefinition<typeof args> = {
|
|
14
|
-
name: "get-announcements",
|
|
15
|
-
description: `Get Announcement Articles
|
|
16
|
-
|
|
17
|
-
Get Announcements
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
- Requires a valid portal ID. If you don't have the portal ID, first call 'get-portals' to get available portals.
|
|
21
|
-
- Portal ID format: 2-4 letter prefix + dash + 4-15 digits (e.g., "EB-123456789")
|
|
22
|
-
|
|
23
|
-
## Overview
|
|
24
|
-
The Get Announcements API allows a user to retrieve all announcement articles for a specific portal. Announcements are special articles that are prominently displayed to users and typically contain important updates, news, or notifications.
|
|
25
|
-
|
|
26
|
-
This API returns announcement articles with their full content, metadata, and any associated attachments or links.
|
|
27
|
-
`,
|
|
28
|
-
annotations: {
|
|
29
|
-
"destructiveHint": false,
|
|
30
|
-
"idempotentHint": false,
|
|
31
|
-
"openWorldHint": false,
|
|
32
|
-
"readOnlyHint": true,
|
|
33
|
-
},
|
|
34
|
-
args,
|
|
35
|
-
tool: async (client, args, ctx) => {
|
|
36
|
-
const [result, apiCall] = await getAnnouncements(
|
|
37
|
-
client,
|
|
38
|
-
args.request,
|
|
39
|
-
{ fetchOptions: { signal: ctx.signal } },
|
|
40
|
-
).$inspect();
|
|
41
|
-
|
|
42
|
-
if (!result.ok) {
|
|
43
|
-
return {
|
|
44
|
-
content: [{ type: "text", text: result.error.message }],
|
|
45
|
-
isError: true,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const value = result.value;
|
|
50
|
-
|
|
51
|
-
return formatResult(value, apiCall);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { getArticle } from "../../funcs/getArticle.js";
|
|
6
|
-
import { GetArticleByIdRequest$zodSchema } from "../../models/getarticlebyidop.js";
|
|
7
|
-
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
-
|
|
9
|
-
const args = {
|
|
10
|
-
request: GetArticleByIdRequest$zodSchema,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const tool$getArticle: ToolDefinition<typeof args> = {
|
|
14
|
-
name: "get-article",
|
|
15
|
-
description: `Get Article by ID
|
|
16
|
-
|
|
17
|
-
Get Article by ID
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
- Requires a valid portal ID. If you don't have the portal ID, first call 'get-portals' to get available portals.
|
|
21
|
-
- Portal ID format: 2-4 letter prefix + dash + 4-15 digits (e.g., "EB-123456789")
|
|
22
|
-
- Requires a valid article ID. Article ID format: 2-4 letter prefix + dash + 4-15 digits (e.g., "PROD-2996")
|
|
23
|
-
|
|
24
|
-
## Overview
|
|
25
|
-
The Get Article by ID API allows a user to retrieve a specific article using its ID. Additional article attributes and contextual views can be specified in the query parameters.
|
|
26
|
-
|
|
27
|
-
This API returns structured authoring attributes of Issue, Environment, Cause and Confidence Level when the following conditions are met:
|
|
28
|
-
- The "Allow Structured Authoring" setting is enabled at the partition/department level
|
|
29
|
-
- The "Use Structured Authoring" flag is set on the article type
|
|
30
|
-
`,
|
|
31
|
-
annotations: {
|
|
32
|
-
"destructiveHint": false,
|
|
33
|
-
"idempotentHint": false,
|
|
34
|
-
"openWorldHint": false,
|
|
35
|
-
"readOnlyHint": true,
|
|
36
|
-
},
|
|
37
|
-
args,
|
|
38
|
-
tool: async (client, args, ctx) => {
|
|
39
|
-
const [result, apiCall] = await getArticle(
|
|
40
|
-
client,
|
|
41
|
-
args.request,
|
|
42
|
-
{ fetchOptions: { signal: ctx.signal } },
|
|
43
|
-
).$inspect();
|
|
44
|
-
|
|
45
|
-
if (!result.ok) {
|
|
46
|
-
return {
|
|
47
|
-
content: [{ type: "text", text: result.error.message }],
|
|
48
|
-
isError: true,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const value = result.value;
|
|
53
|
-
|
|
54
|
-
return formatResult(value, apiCall);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { queryAnswers } from "../../funcs/queryAnswers.js";
|
|
6
|
-
import { GetBestAnswerRequest$zodSchema } from "../../models/getbestanswerop.js";
|
|
7
|
-
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
-
|
|
9
|
-
const args = {
|
|
10
|
-
request: GetBestAnswerRequest$zodSchema,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const tool$queryAnswers: ToolDefinition<typeof args> = {
|
|
14
|
-
name: "query-answers",
|
|
15
|
-
description: `Generate an Answer
|
|
16
|
-
|
|
17
|
-
Get Answers
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
- Requires a valid portal ID. If you don't have the portal ID, first call 'get-portals' to get available portals.
|
|
21
|
-
- Portal ID format: 2-4 letter prefix + dash + 4-15 digits (e.g., "EB-123456789")
|
|
22
|
-
|
|
23
|
-
## Overview
|
|
24
|
-
The Answers API enables users to get the best answer for a user query. This API can return certified answers or generative answers along with search results, providing users with comprehensive responses to their questions.
|
|
25
|
-
|
|
26
|
-
The API leverages AI capabilities to provide intelligent answers based on the knowledge base content, making it easier for users to find the information they need quickly and accurately.
|
|
27
|
-
|
|
28
|
-
## Request Body Notes
|
|
29
|
-
- **channel field**: Optional. **Recommended to omit** unless specifically needed. The API works reliably without it. If you receive a 400 Bad Request error when including channel, retry the request without the channel field.
|
|
30
|
-
- **Required fields**: eventId and sessionId are required in the request body.
|
|
31
|
-
`,
|
|
32
|
-
annotations: {
|
|
33
|
-
"destructiveHint": false,
|
|
34
|
-
"idempotentHint": false,
|
|
35
|
-
"openWorldHint": false,
|
|
36
|
-
"readOnlyHint": false,
|
|
37
|
-
},
|
|
38
|
-
args,
|
|
39
|
-
tool: async (client, args, ctx) => {
|
|
40
|
-
const [result, apiCall] = await queryAnswers(
|
|
41
|
-
client,
|
|
42
|
-
args.request,
|
|
43
|
-
{ fetchOptions: { signal: ctx.signal } },
|
|
44
|
-
).$inspect();
|
|
45
|
-
|
|
46
|
-
if (!result.ok) {
|
|
47
|
-
return {
|
|
48
|
-
content: [{ type: "text", text: result.error.message }],
|
|
49
|
-
isError: true,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const value = result.value;
|
|
54
|
-
|
|
55
|
-
return formatResult(value, apiCall);
|
|
56
|
-
},
|
|
57
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { queryRetrieve } from "../../funcs/queryRetrieve.js";
|
|
6
|
-
import { RetrieveChunksRequest$zodSchema } from "../../models/retrievechunksop.js";
|
|
7
|
-
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
-
|
|
9
|
-
const args = {
|
|
10
|
-
request: RetrieveChunksRequest$zodSchema,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const tool$queryRetrieve: ToolDefinition<typeof args> = {
|
|
14
|
-
name: "query-retrieve",
|
|
15
|
-
description: `Retrieve Chunks
|
|
16
|
-
|
|
17
|
-
Retrieve Chunks
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
- **Requires a valid portal ID** (required parameter). If you don't have the portal ID, first call 'get-portals' to get available portals.
|
|
21
|
-
- Portal ID format: 2-4 letter prefix + dash + 4-15 digits (e.g., "EB-123456789")
|
|
22
|
-
|
|
23
|
-
## Overview
|
|
24
|
-
The Retrieve API enables enterprises to directly access relevant content chunks from their organizational knowledge sources. It is designed for scenarios where developers want granular control over retrieved information, such as powering custom search, analytics, or retrieval-augmented generation (RAG) pipelines.
|
|
25
|
-
|
|
26
|
-
In addition to raw chunk retrieval, the API can return **Certified Answers** if it meets the 'Certified Answer' threshold score. Responses include relevance scores, metadata, and references to maintain transparency and flexibility.
|
|
27
|
-
|
|
28
|
-
By leveraging the Retrieve API, organizations can build tailored experiences while retaining confidence in the source material.
|
|
29
|
-
`,
|
|
30
|
-
annotations: {
|
|
31
|
-
"destructiveHint": false,
|
|
32
|
-
"idempotentHint": false,
|
|
33
|
-
"openWorldHint": false,
|
|
34
|
-
"readOnlyHint": false,
|
|
35
|
-
},
|
|
36
|
-
args,
|
|
37
|
-
tool: async (client, args, ctx) => {
|
|
38
|
-
const [result, apiCall] = await queryRetrieve(
|
|
39
|
-
client,
|
|
40
|
-
args.request,
|
|
41
|
-
{ fetchOptions: { signal: ctx.signal } },
|
|
42
|
-
).$inspect();
|
|
43
|
-
|
|
44
|
-
if (!result.ok) {
|
|
45
|
-
return {
|
|
46
|
-
content: [{ type: "text", text: result.error.message }],
|
|
47
|
-
isError: true,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const value = result.value;
|
|
52
|
-
|
|
53
|
-
return formatResult(value, apiCall);
|
|
54
|
-
},
|
|
55
|
-
};
|