@egain/egain-mcp-server 1.0.6 → 1.0.11

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 (36) hide show
  1. package/README.md +22 -0
  2. package/bin/mcp-server.js +191 -171
  3. package/bin/mcp-server.js.map +9 -9
  4. package/esm/src/funcs/getPortals.d.ts +48 -7
  5. package/esm/src/funcs/getPortals.d.ts.map +1 -1
  6. package/esm/src/funcs/getPortals.js +48 -7
  7. package/esm/src/funcs/getPortals.js.map +1 -1
  8. package/esm/src/hooks/auth-hook.d.ts +6 -1
  9. package/esm/src/hooks/auth-hook.d.ts.map +1 -1
  10. package/esm/src/hooks/auth-hook.js +174 -197
  11. package/esm/src/hooks/auth-hook.js.map +1 -1
  12. package/esm/src/hooks/tooltip-images.d.ts +10 -0
  13. package/esm/src/hooks/tooltip-images.d.ts.map +1 -0
  14. package/esm/src/hooks/tooltip-images.js +12 -0
  15. package/esm/src/hooks/tooltip-images.js.map +1 -0
  16. package/esm/src/lib/config.d.ts +2 -2
  17. package/esm/src/lib/config.js +2 -2
  18. package/esm/src/lib/config.js.map +1 -1
  19. package/esm/src/mcp-server/mcp-server.js +1 -1
  20. package/esm/src/mcp-server/mcp-server.js.map +1 -1
  21. package/esm/src/mcp-server/server.js +1 -1
  22. package/esm/src/mcp-server/server.js.map +1 -1
  23. package/esm/src/mcp-server/tools/getPortals.d.ts.map +1 -1
  24. package/esm/src/mcp-server/tools/getPortals.js +48 -7
  25. package/esm/src/mcp-server/tools/getPortals.js.map +1 -1
  26. package/esm/src/models/getmyportalsop.d.ts +1 -1
  27. package/esm/src/models/getmyportalsop.d.ts.map +1 -1
  28. package/manifest.json +2 -2
  29. package/package.json +1 -1
  30. package/src/funcs/getPortals.ts +48 -7
  31. package/src/hooks/auth-hook.ts +185 -224
  32. package/src/lib/config.ts +2 -2
  33. package/src/mcp-server/mcp-server.ts +1 -1
  34. package/src/mcp-server/server.ts +1 -1
  35. package/src/mcp-server/tools/getPortals.ts +48 -7
  36. package/src/models/getmyportalsop.ts +1 -1
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "1.0.6",
22
+ currentVersion: "1.0.11",
23
23
  },
24
24
  });
25
25
 
@@ -34,7 +34,7 @@ export function createMCPServer(deps: {
34
34
  }) {
35
35
  const server = new McpServer({
36
36
  name: "EgainMcp",
37
- version: "1.0.6",
37
+ version: "1.0.11",
38
38
  });
39
39
 
40
40
  const getClient = deps.getSDK || (() =>
@@ -14,14 +14,55 @@ export const tool$getPortals: ToolDefinition<typeof args> = {
14
14
  name: "get-portals",
15
15
  description: `Get All Portals Accessible To User
16
16
 
17
+ Get All Portals Accessible to User
18
+
17
19
  ## Overview
18
- The Get All Portals Accessible to User API allows a user to fetch all portals accessible to user across all department.
19
- * If no access tags are specified for a portal, then any user can access the portal.
20
- * If access tags are specified for a portal, users with a user profile that allows access have access to the portal. For users with multiple user profiles, the user profile that allows access does not need to be the active user profile.
21
- * All the global users(partition) cannot be assigned user profiles; their access is limited to portals without access restrictions.
22
- * The only articles returned are associated to an Article type when the parameter, “Include in browse on portals” is set to "Yes".
23
- * When the "shortUrlTemplate" query parameter is provided, the API filters accessible portals according to the specified language and template name. Portal Short URL specific to to the "shortUrlTemplate" query parameter value is returned in the response.
24
- * When there is no short URL available for a specific language, the API returns a portal object with an empty "shortURL" field.
20
+ The Get All Portals Accessible to User API allows a user to fetch all portals accessible to the user across all departments.
21
+ - If no access tags are specified for a portal, any user can access the portal.
22
+ - If access tags are specified for a portal, users with a user profile that allows access can access the portal. For users with multiple user profiles, the user profile that allows access does not need to be the active user profile.
23
+ - Global users (partition) cannot be assigned user profiles; their access is limited to portals without access restrictions.
24
+ - The only articles returned are associated to an Article type when the parameter “Include in browse on portals” is set to "Yes".
25
+ - When the \`shortUrlTemplate\` query parameter is provided, the API filters accessible portals according to the specified language and template name. A portal short URL specific to the \`shortUrlTemplate\` value is returned in the response when available. If there is no short URL for a language, the portal object returns an empty \`shortURL\` field.
26
+
27
+ ## Pagination behavior (CRITICAL for AI assistants)
28
+
29
+ **IMPORTANT**: This endpoint is paginated. When searching for a portal by name or listing portals, you MUST automatically fetch ALL pages before concluding that a portal doesn't exist.
30
+
31
+ ### Automatic pagination is REQUIRED when:
32
+ - User asks to find a portal by name (e.g., "business portal", "Master portal")
33
+ - User requests to list or see all portals
34
+ - You need to resolve a natural portal name to its ID
35
+
36
+ ### How to detect more pages exist:
37
+ The response includes \`paginationInfo\` with:
38
+ - \`count\`: Total number of items across all pages
39
+ - \`pagenum\`: Current page number
40
+ - \`pagesize\`: Items per page (default: 25)
41
+
42
+ **Check for more pages if ANY of these are true:**
43
+ 1. The number of portals returned equals \`pagesize\` (e.g., exactly 25 portals returned)
44
+ 2. \`paginationInfo.count > (pagenum * pagesize)\` - there are more items beyond this page
45
+ 3. The response includes a \`link\` array with a \`next\` relation
46
+
47
+ ### Required pagination workflow:
48
+ 1. Start with \`$pagenum=1\` and \`$pagesize=25\` (default)
49
+ 2. After receiving the response, check \`paginationInfo\`
50
+ 3. **If more pages exist** (using the checks above), automatically call this endpoint again with \`$pagenum=2\`, then \`$pagenum=3\`, etc.
51
+ 4. Continue incrementing \`$pagenum\` until:
52
+ - A page returns fewer portals than \`pagesize\` (indicating the last page)
53
+ - A page returns zero portals
54
+ - \`pagenum * pagesize >= paginationInfo.count\` (if count represents total items)
55
+ 5. Merge all portals from all pages by unique portal ID
56
+ 6. Only then search through the complete merged list or report results to the user
57
+
58
+ ### Example scenario:
59
+ If you search for "business portal" and the first page returns 25 portals but none match:
60
+ - DO NOT immediately tell the user the portal doesn't exist
61
+ - Check \`paginationInfo.count\` - if it's > 25, automatically fetch page 2
62
+ - Continue fetching until all pages are retrieved
63
+ - Search the complete merged list before concluding the portal doesn't exist
64
+
65
+ This ensures reliable portal name-to-ID resolution and prevents false "not found" errors.
25
66
  `,
26
67
  annotations: {
27
68
  "destructiveHint": false,
@@ -27,8 +27,8 @@ export type GetMyPortalsRequest = {
27
27
  shortUrlTemplate?: string | undefined;
28
28
  Dollar_sort?: SortIdNameDepartment | undefined;
29
29
  Dollar_order?: Order | undefined;
30
- Dollar_pagenum?: number | undefined;
31
30
  Dollar_pagesize?: number | undefined;
31
+ Dollar_pagenum?: number | undefined;
32
32
  };
33
33
 
34
34
  export const GetMyPortalsRequest$zodSchema: z.ZodType<