@burdenoff/mcp-libs 2026.522.1 → 2026.525.1

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 (73) hide show
  1. package/dist/chunk-HRWIDQJE.js +1771 -0
  2. package/dist/chunk-HRWIDQJE.js.map +1 -0
  3. package/dist/modules/auth/index.cjs +317 -0
  4. package/dist/modules/auth/index.cjs.map +1 -1
  5. package/dist/modules/auth/index.js +289 -1
  6. package/dist/modules/auth/index.js.map +1 -1
  7. package/dist/modules/channels/index.cjs +47 -0
  8. package/dist/modules/channels/index.cjs.map +1 -1
  9. package/dist/modules/channels/index.js +47 -0
  10. package/dist/modules/channels/index.js.map +1 -1
  11. package/dist/modules/conversations/index.cjs +1355 -0
  12. package/dist/modules/conversations/index.cjs.map +1 -1
  13. package/dist/modules/conversations/index.js +1355 -0
  14. package/dist/modules/conversations/index.js.map +1 -1
  15. package/dist/modules/devportal/index.cjs +281 -0
  16. package/dist/modules/devportal/index.cjs.map +1 -1
  17. package/dist/modules/devportal/index.js +281 -0
  18. package/dist/modules/devportal/index.js.map +1 -1
  19. package/dist/modules/export/index.cjs +348 -0
  20. package/dist/modules/export/index.cjs.map +1 -1
  21. package/dist/modules/export/index.js +348 -0
  22. package/dist/modules/export/index.js.map +1 -1
  23. package/dist/modules/files/index.cjs +244 -2
  24. package/dist/modules/files/index.cjs.map +1 -1
  25. package/dist/modules/files/index.js +244 -2
  26. package/dist/modules/files/index.js.map +1 -1
  27. package/dist/modules/integrations/index.cjs +539 -0
  28. package/dist/modules/integrations/index.cjs.map +1 -1
  29. package/dist/modules/integrations/index.js +539 -0
  30. package/dist/modules/integrations/index.js.map +1 -1
  31. package/dist/modules/organizations/index.cjs +211 -0
  32. package/dist/modules/organizations/index.cjs.map +1 -1
  33. package/dist/modules/organizations/index.js +211 -0
  34. package/dist/modules/organizations/index.js.map +1 -1
  35. package/dist/modules/products/index.cjs +131 -0
  36. package/dist/modules/products/index.cjs.map +1 -1
  37. package/dist/modules/products/index.js +131 -0
  38. package/dist/modules/products/index.js.map +1 -1
  39. package/dist/modules/rbac/index.cjs +114 -0
  40. package/dist/modules/rbac/index.cjs.map +1 -1
  41. package/dist/modules/rbac/index.js +114 -0
  42. package/dist/modules/rbac/index.js.map +1 -1
  43. package/dist/modules/sandbox/index.cjs +864 -0
  44. package/dist/modules/sandbox/index.cjs.map +1 -1
  45. package/dist/modules/sandbox/index.js +699 -1
  46. package/dist/modules/sandbox/index.js.map +1 -1
  47. package/dist/modules/scheduler/index.cjs +860 -0
  48. package/dist/modules/scheduler/index.cjs.map +1 -1
  49. package/dist/modules/scheduler/index.js +860 -0
  50. package/dist/modules/scheduler/index.js.map +1 -1
  51. package/dist/modules/security/index.cjs +51 -0
  52. package/dist/modules/security/index.cjs.map +1 -1
  53. package/dist/modules/security/index.js +51 -0
  54. package/dist/modules/security/index.js.map +1 -1
  55. package/dist/modules/store/index.cjs +102 -0
  56. package/dist/modules/store/index.cjs.map +1 -1
  57. package/dist/modules/store/index.js +102 -0
  58. package/dist/modules/store/index.js.map +1 -1
  59. package/dist/modules/tours/index.cjs +43 -0
  60. package/dist/modules/tours/index.cjs.map +1 -1
  61. package/dist/modules/tours/index.js +43 -0
  62. package/dist/modules/tours/index.js.map +1 -1
  63. package/dist/modules/vibecontrols/index.cjs +4618 -668
  64. package/dist/modules/vibecontrols/index.cjs.map +1 -1
  65. package/dist/modules/vibecontrols/index.js +3626 -434
  66. package/dist/modules/vibecontrols/index.js.map +1 -1
  67. package/dist/modules/workspaces/index.cjs +46 -3
  68. package/dist/modules/workspaces/index.cjs.map +1 -1
  69. package/dist/modules/workspaces/index.js +46 -3
  70. package/dist/modules/workspaces/index.js.map +1 -1
  71. package/package.json +4 -3
  72. package/dist/chunk-4GBVJ4OY.js +0 -847
  73. package/dist/chunk-4GBVJ4OY.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/modules/store/operations.ts","../../../src/modules/store/tools.ts","../../../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AQ","file":"index.js","sourcesContent":["export const BROWSE_STORE = `\n query BrowseStore($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n products { id name description price currency type status }\n facets { categories types }\n totalCount hasMore\n }\n }\n`;\n\nexport const SEARCH_STORE = `\n query SearchStore($query: String!, $filters: StoreFiltersInput) {\n searchStore(query: $query, filters: $filters) {\n id name price currency type activeInstallCount\n }\n }\n`;\n\nexport const GET_STORE_PRODUCT = `\n query GetStoreProduct($id: ID!) {\n getProduct(id: $id) {\n id name description price currency type status\n publisher { name }\n }\n }\n`;\n\nexport const MY_CART = `\n query MyCart {\n myCart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n }\n`;\n\nexport const ADD_TO_CART = `\n mutation AddToCart($input: AddToCartInput!) {\n addToCart(input: $input) {\n id itemCount subtotal items { productId quantity }\n }\n }\n`;\n\nexport const REMOVE_FROM_CART = `\n mutation RemoveFromCart($cartId: ID!, $itemId: ID!) {\n removeFromCart(cartId: $cartId, itemId: $itemId) {\n id itemCount subtotal\n }\n }\n`;\n\nexport const CHECKOUT_CART = `\n mutation CheckoutCart($cartId: ID!) {\n checkoutCart(cartId: $cartId) {\n success order { id total status }\n }\n }\n`;\n\nexport const GET_ORDERS = `\n query GetOrders($limit: Int, $offset: Int) {\n getOrders(limit: $limit, offset: $offset) {\n id status total currency createdAt\n }\n }\n`;\n\nexport const GET_ORDER = `\n query GetOrder($id: ID!) {\n getOrder(id: $id) {\n id status total currency paidAt billingAccountId\n lineItems { productId quantity unitPrice }\n }\n }\n`;\n\nexport const GET_INSTALLED_PRODUCTS = `\n query GetInstalledProducts($workspaceId: ID!) {\n getInstalledProducts(workspaceId: $workspaceId) {\n id application { id name } status installedAt lastUsedAt\n }\n }\n`;\n\nexport const UNINSTALL_PRODUCT = `\n mutation UninstallProduct($installationId: ID!) {\n uninstallProduct(installationId: $installationId) { success }\n }\n`;\n\nexport const GET_LICENSES = `\n query GetLicenses($entitlementId: ID!) {\n getLicenses(entitlementId: $entitlementId) {\n id status validFrom expiresAt\n }\n }\n`;\n","/**\n * Store module tools — marketplace search, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n *\n * Note: store_cart_checkout completes the cart server-side (no browser\n * redirect). Provider-bound payment capture (Stripe checkout pages) is not\n * exposed in cli-sdk and is omitted here.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n BROWSE_STORE,\n SEARCH_STORE,\n GET_STORE_PRODUCT,\n MY_CART,\n ADD_TO_CART,\n REMOVE_FROM_CART,\n CHECKOUT_CART,\n GET_ORDERS,\n GET_ORDER,\n GET_INSTALLED_PRODUCTS,\n UNINSTALL_PRODUCT,\n GET_LICENSES,\n} from './operations.js';\n\ninterface StoreProduct {\n id: string;\n name: string;\n price?: number;\n currency?: string;\n type?: string;\n status?: string;\n}\n\ninterface CartRow {\n id: string;\n itemCount?: number;\n subtotal?: number;\n total?: number;\n currency?: string;\n isEmpty?: boolean;\n items?: Array<{ id: string; productId: string; quantity: number }>;\n}\n\ninterface OrderRow {\n id: string;\n status?: string;\n total?: number;\n currency?: string;\n createdAt?: string;\n}\n\nfunction resolveWorkspaceId(ctx: McpContext, override: string | undefined): string | null {\n if (override !== undefined && override !== '') return override;\n const auth = ctx.auth.read();\n if (!auth?.workspaceId) return null;\n return auth.workspaceId;\n}\n\nexport function registerStoreTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n // ── Search / browse / get ──────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_search')),\n {\n title: 'Search Store',\n description: 'Search the marketplace for products by query and optional filters.',\n inputSchema: {\n query: z.string().describe('Search query'),\n type: z.string().optional().describe('Product type filter'),\n category: z.string().optional().describe('Category filter'),\n },\n },\n async ({ query, type, category }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (type !== undefined) filters.productType = type.toUpperCase();\n if (category !== undefined) filters.category = category;\n const data = await ctx.gql.global.request<{ searchStore: StoreProduct[] }>(SEARCH_STORE, {\n query,\n filters: Object.keys(filters).length ? filters : undefined,\n });\n return jsonResult(data.searchStore);\n } catch (error) {\n ctx.logger.error('store_search failed', { error: String(error) });\n return errorResult(\n `Failed to search store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_browse')),\n {\n title: 'Browse Store',\n description: 'Browse the marketplace with structured input (categories, facets, paging).',\n inputSchema: {\n category: z.string().optional().describe('Category filter'),\n type: z.string().optional().describe('Product type filter'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Skip results'),\n },\n },\n async ({ category, type, limit, offset }) => {\n try {\n const input: Record<string, unknown> = {};\n if (category !== undefined) input.category = category;\n if (type !== undefined) input.productType = type.toUpperCase();\n if (limit !== undefined) input.limit = limit;\n if (offset !== undefined) input.offset = offset;\n const data = await ctx.gql.global.request<{\n browseStore: {\n products: StoreProduct[];\n facets: { categories: string[]; types: string[] };\n totalCount: number;\n hasMore: boolean;\n };\n }>(BROWSE_STORE, { input });\n return jsonResult(data.browseStore);\n } catch (error) {\n ctx.logger.error('store_browse failed', { error: String(error) });\n return errorResult(\n `Failed to browse store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_get_product')),\n {\n title: 'Get Store Product',\n description: 'Get a marketplace product by ID.',\n inputSchema: { id: z.string().describe('Product ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getProduct: StoreProduct | null }>(\n GET_STORE_PRODUCT,\n { id },\n );\n if (!data.getProduct) return errorResult(`Product ${id} not found`);\n return jsonResult(data.getProduct);\n } catch (error) {\n ctx.logger.error('store_get_product failed', { error: String(error) });\n return errorResult(\n `Failed to get product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Cart ───────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_list')),\n {\n title: 'Show Cart',\n description: \"Show the current user's cart.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myCart: CartRow }>(MY_CART);\n return jsonResult(data.myCart);\n } catch (error) {\n ctx.logger.error('store_cart_list failed', { error: String(error) });\n return errorResult(\n `Failed to fetch cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_add')),\n {\n title: 'Add to Cart',\n description: 'Add a product (and optional variant) to the cart.',\n inputSchema: {\n product: z.string().describe('Product ID'),\n quantity: z.number().optional().describe('Quantity (default 1)'),\n variant: z.string().optional().describe('Variant ID'),\n },\n },\n async ({ product, quantity, variant }) => {\n try {\n const input: Record<string, unknown> = { productId: product };\n if (quantity !== undefined) input.quantity = quantity;\n if (variant !== undefined) input.variantId = variant;\n const data = await ctx.gql.global.request<{ addToCart: CartRow }>(ADD_TO_CART, { input });\n return jsonResult(data.addToCart);\n } catch (error) {\n ctx.logger.error('store_cart_add failed', { error: String(error) });\n return errorResult(\n `Failed to add to cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_remove')),\n {\n title: 'Remove from Cart',\n description: 'Remove an item from the cart.',\n inputSchema: {\n cart: z.string().describe('Cart ID'),\n item: z.string().describe('Cart item ID'),\n },\n },\n async ({ cart, item }) => {\n try {\n await ctx.gql.global.request(REMOVE_FROM_CART, { cartId: cart, itemId: item });\n return jsonResult({ status: 'success', message: 'Item removed from cart', cart, item });\n } catch (error) {\n ctx.logger.error('store_cart_remove failed', { error: String(error) });\n return errorResult(\n `Failed to remove cart item: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_checkout')),\n {\n title: 'Checkout Cart',\n description:\n 'Check out the cart server-side (uses default payment method on the billing account).',\n inputSchema: { cartId: z.string().describe('Cart ID') },\n },\n async ({ cartId }) => {\n try {\n const data = await ctx.gql.global.request<{\n checkoutCart: { success: boolean; order?: OrderRow };\n }>(CHECKOUT_CART, { cartId });\n return jsonResult(data.checkoutCart);\n } catch (error) {\n ctx.logger.error('store_cart_checkout failed', { error: String(error) });\n return errorResult(\n `Failed to checkout cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Orders ─────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_list')),\n {\n title: 'List Orders',\n description: 'List orders for the current user.',\n inputSchema: {\n limit: z.number().optional().describe('Page size (default 50)'),\n offset: z.number().optional().describe('Skip results (default 0)'),\n },\n },\n async ({ limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrders: OrderRow[] }>(GET_ORDERS, {\n limit,\n offset: offset ?? 0,\n });\n return jsonResult(data.getOrders);\n } catch (error) {\n ctx.logger.error('store_orders_list failed', { error: String(error) });\n return errorResult(\n `Failed to list orders: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_get')),\n {\n title: 'Get Order',\n description: 'Get an order by ID.',\n inputSchema: { id: z.string().describe('Order ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrder: OrderRow | null }>(GET_ORDER, { id });\n if (!data.getOrder) return errorResult(`Order ${id} not found`);\n return jsonResult(data.getOrder);\n } catch (error) {\n ctx.logger.error('store_orders_get failed', { error: String(error) });\n return errorResult(\n `Failed to get order: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Installed ──────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_list')),\n {\n title: 'List Installed Products',\n description: 'List installed products in the current (or specified) workspace.',\n inputSchema: {\n workspace: z.string().optional().describe('Workspace ID (defaults to current)'),\n },\n },\n async ({ workspace }) => {\n try {\n const wid = resolveWorkspaceId(ctx, workspace);\n if (!wid) {\n return errorResult(\n 'No active workspace. Bind a workspace via the auth login flow first.',\n );\n }\n const data = await ctx.gql.global.request<{\n getInstalledProducts: Array<{\n id: string;\n application: { id: string; name: string };\n status: string;\n installedAt: string;\n }>;\n }>(GET_INSTALLED_PRODUCTS, { workspaceId: wid });\n return jsonResult(data.getInstalledProducts);\n } catch (error) {\n ctx.logger.error('store_installed_list failed', { error: String(error) });\n return errorResult(\n `Failed to list installed products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_uninstall')),\n {\n title: 'Uninstall Product',\n description: 'Uninstall a product by installation ID.',\n inputSchema: { installationId: z.string().describe('Installation ID') },\n },\n async ({ installationId }) => {\n try {\n await ctx.gql.global.request(UNINSTALL_PRODUCT, { installationId });\n return jsonResult({ status: 'success', message: 'Product uninstalled', installationId });\n } catch (error) {\n ctx.logger.error('store_installed_uninstall failed', { error: String(error) });\n return errorResult(\n `Failed to uninstall product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Licenses ───────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_licenses_list')),\n {\n title: 'List Licenses',\n description: 'List licenses for an entitlement.',\n inputSchema: { entitlement: z.string().describe('Entitlement ID') },\n },\n async ({ entitlement }) => {\n try {\n const data = await ctx.gql.global.request<{\n getLicenses: Array<{ id: string; status: string; validFrom: string; expiresAt: string }>;\n }>(GET_LICENSES, { entitlementId: entitlement });\n return jsonResult(data.getLicenses);\n } catch (error) {\n ctx.logger.error('store_licenses_list failed', { error: String(error) });\n return errorResult(\n `Failed to list licenses: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Store module — marketplace search/browse, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerStoreTools } from './tools.js';\n\nconst storeModule: McpModule = {\n id: 'store',\n version: '0.0.1',\n displayName: 'Store',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerStoreTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default storeModule;\n"]}
1
+ {"version":3,"sources":["../../../src/modules/store/operations.ts","../../../src/modules/store/tools.ts","../../../src/modules/store/index.ts"],"names":[],"mappings":";;;;AAAO,IAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAUrB,IAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQrB,IAAM,iBAAA,GAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAS1B,IAAM,OAAA,GAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAShB,IAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQpB,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQzB,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQtB,IAAM,UAAA,GAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQnB,IAAM,SAAA,GAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AASlB,IAAM,sBAAA,GAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQ/B,IAAM,iBAAA,GAAoB;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AAA,EAAmC,EAAE,OAAO,MAAA,CAAO,KAAK,GAAG,CAAA;AAC5E,QAAA,OAAO,WAAA;AAAA,UACL,sCAAsC,KAAA,YAAiB,KAAA,GAAQ,MAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,SAC9F;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;;;AC3cA,IAAM,WAAA,GAAyB;AAAA,EAC7B,EAAA,EAAI,OAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,OAAA;AAAA,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,kBAAA,CAAmB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["export const BROWSE_STORE = `\n query BrowseStore($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n products { id name description price currency type status }\n facets { categories types }\n totalCount hasMore\n }\n }\n`;\n\nexport const SEARCH_STORE = `\n query SearchStore($query: String!, $filters: StoreFiltersInput) {\n searchStore(query: $query, filters: $filters) {\n id name price currency type activeInstallCount\n }\n }\n`;\n\nexport const GET_STORE_PRODUCT = `\n query GetStoreProduct($id: ID!) {\n getProduct(id: $id) {\n id name description price currency type status\n publisher { name }\n }\n }\n`;\n\nexport const MY_CART = `\n query MyCart {\n myCart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n }\n`;\n\nexport const ADD_TO_CART = `\n mutation AddToCart($input: AddToCartInput!) {\n addToCart(input: $input) {\n id itemCount subtotal items { productId quantity }\n }\n }\n`;\n\nexport const REMOVE_FROM_CART = `\n mutation RemoveFromCart($cartId: ID!, $itemId: ID!) {\n removeFromCart(cartId: $cartId, itemId: $itemId) {\n id itemCount subtotal\n }\n }\n`;\n\nexport const CHECKOUT_CART = `\n mutation CheckoutCart($cartId: ID!) {\n checkoutCart(cartId: $cartId) {\n success order { id total status }\n }\n }\n`;\n\nexport const GET_ORDERS = `\n query GetOrders($limit: Int, $offset: Int) {\n getOrders(limit: $limit, offset: $offset) {\n id status total currency createdAt\n }\n }\n`;\n\nexport const GET_ORDER = `\n query GetOrder($id: ID!) {\n getOrder(id: $id) {\n id status total currency paidAt billingAccountId\n lineItems { productId quantity unitPrice }\n }\n }\n`;\n\nexport const GET_INSTALLED_PRODUCTS = `\n query GetInstalledProducts($workspaceId: ID!) {\n getInstalledProducts(workspaceId: $workspaceId) {\n id application { id name } status installedAt lastUsedAt\n }\n }\n`;\n\nexport const UNINSTALL_PRODUCT = `\n mutation UninstallProduct($installationId: ID!) {\n uninstallProduct(installationId: $installationId) { success }\n }\n`;\n\nexport const GET_LICENSES = `\n query GetLicenses($entitlementId: ID!) {\n getLicenses(entitlementId: $entitlementId) {\n id status validFrom expiresAt\n }\n }\n`;\n\nexport const CLEAR_CART = `\n mutation ClearCart {\n clearCart {\n cart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n errors { code field message }\n }\n }\n`;\n\nexport const GET_MY_PUBLISHER = `\n query MyPublisher {\n myPublisher {\n id name legalName email contactEmail websiteUrl\n bio logoUrl isVerified verificationStatus\n productCount totalSales totalEarnings tier\n createdAt updatedAt\n }\n }\n`;\n\nexport const GET_MY_PUBLISHER_PRODUCTS = `\n query MyPublisherProducts {\n myPublisher {\n id productCount\n products {\n id name slug description price currency type status downloads\n publisher { id name isVerified }\n }\n }\n }\n`;\n","/**\n * Store module tools — marketplace search, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n *\n * Note: store_cart_checkout completes the cart server-side (no browser\n * redirect). Provider-bound payment capture (Stripe checkout pages) is not\n * exposed in cli-sdk and is omitted here.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n BROWSE_STORE,\n SEARCH_STORE,\n GET_STORE_PRODUCT,\n MY_CART,\n ADD_TO_CART,\n REMOVE_FROM_CART,\n CHECKOUT_CART,\n CLEAR_CART,\n GET_ORDERS,\n GET_ORDER,\n GET_INSTALLED_PRODUCTS,\n UNINSTALL_PRODUCT,\n GET_LICENSES,\n GET_MY_PUBLISHER,\n GET_MY_PUBLISHER_PRODUCTS,\n} from './operations.js';\n\ninterface StoreProduct {\n id: string;\n name: string;\n price?: number;\n currency?: string;\n type?: string;\n status?: string;\n}\n\ninterface CartRow {\n id: string;\n itemCount?: number;\n subtotal?: number;\n total?: number;\n currency?: string;\n isEmpty?: boolean;\n items?: Array<{ id: string; productId: string; quantity: number }>;\n}\n\ninterface OrderRow {\n id: string;\n status?: string;\n total?: number;\n currency?: string;\n createdAt?: string;\n}\n\nfunction resolveWorkspaceId(ctx: McpContext, override: string | undefined): string | null {\n if (override !== undefined && override !== '') return override;\n const auth = ctx.auth.read();\n if (!auth?.workspaceId) return null;\n return auth.workspaceId;\n}\n\nexport function registerStoreTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n // ── Search / browse / get ──────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_search')),\n {\n title: 'Search Store',\n description: 'Search the marketplace for products by query and optional filters.',\n inputSchema: {\n query: z.string().describe('Search query'),\n type: z.string().optional().describe('Product type filter'),\n category: z.string().optional().describe('Category filter'),\n },\n },\n async ({ query, type, category }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (type !== undefined) filters.productType = type.toUpperCase();\n if (category !== undefined) filters.category = category;\n const data = await ctx.gql.global.request<{ searchStore: StoreProduct[] }>(SEARCH_STORE, {\n query,\n filters: Object.keys(filters).length ? filters : undefined,\n });\n return jsonResult(data.searchStore);\n } catch (error) {\n ctx.logger.error('store_search failed', { error: String(error) });\n return errorResult(\n `Failed to search store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_browse')),\n {\n title: 'Browse Store',\n description: 'Browse the marketplace with structured input (categories, facets, paging).',\n inputSchema: {\n category: z.string().optional().describe('Category filter'),\n type: z.string().optional().describe('Product type filter'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Skip results'),\n },\n },\n async ({ category, type, limit, offset }) => {\n try {\n const input: Record<string, unknown> = {};\n if (category !== undefined) input.category = category;\n if (type !== undefined) input.productType = type.toUpperCase();\n if (limit !== undefined) input.limit = limit;\n if (offset !== undefined) input.offset = offset;\n const data = await ctx.gql.global.request<{\n browseStore: {\n products: StoreProduct[];\n facets: { categories: string[]; types: string[] };\n totalCount: number;\n hasMore: boolean;\n };\n }>(BROWSE_STORE, { input });\n return jsonResult(data.browseStore);\n } catch (error) {\n ctx.logger.error('store_browse failed', { error: String(error) });\n return errorResult(\n `Failed to browse store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_get_product')),\n {\n title: 'Get Store Product',\n description: 'Get a marketplace product by ID.',\n inputSchema: { id: z.string().describe('Product ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getProduct: StoreProduct | null }>(\n GET_STORE_PRODUCT,\n { id },\n );\n if (!data.getProduct) return errorResult(`Product ${id} not found`);\n return jsonResult(data.getProduct);\n } catch (error) {\n ctx.logger.error('store_get_product failed', { error: String(error) });\n return errorResult(\n `Failed to get product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Cart ───────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_list')),\n {\n title: 'Show Cart',\n description: \"Show the current user's cart.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myCart: CartRow }>(MY_CART);\n return jsonResult(data.myCart);\n } catch (error) {\n ctx.logger.error('store_cart_list failed', { error: String(error) });\n return errorResult(\n `Failed to fetch cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_add')),\n {\n title: 'Add to Cart',\n description: 'Add a product (and optional variant) to the cart.',\n inputSchema: {\n product: z.string().describe('Product ID'),\n quantity: z.number().optional().describe('Quantity (default 1)'),\n variant: z.string().optional().describe('Variant ID'),\n },\n },\n async ({ product, quantity, variant }) => {\n try {\n const input: Record<string, unknown> = { productId: product };\n if (quantity !== undefined) input.quantity = quantity;\n if (variant !== undefined) input.variantId = variant;\n const data = await ctx.gql.global.request<{ addToCart: CartRow }>(ADD_TO_CART, { input });\n return jsonResult(data.addToCart);\n } catch (error) {\n ctx.logger.error('store_cart_add failed', { error: String(error) });\n return errorResult(\n `Failed to add to cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_remove')),\n {\n title: 'Remove from Cart',\n description: 'Remove an item from the cart.',\n inputSchema: {\n cart: z.string().describe('Cart ID'),\n item: z.string().describe('Cart item ID'),\n },\n },\n async ({ cart, item }) => {\n try {\n await ctx.gql.global.request(REMOVE_FROM_CART, { cartId: cart, itemId: item });\n return jsonResult({ status: 'success', message: 'Item removed from cart', cart, item });\n } catch (error) {\n ctx.logger.error('store_cart_remove failed', { error: String(error) });\n return errorResult(\n `Failed to remove cart item: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_checkout')),\n {\n title: 'Checkout Cart',\n description:\n 'Check out the cart server-side (uses default payment method on the billing account).',\n inputSchema: { cartId: z.string().describe('Cart ID') },\n },\n async ({ cartId }) => {\n try {\n const data = await ctx.gql.global.request<{\n checkoutCart: { success: boolean; order?: OrderRow };\n }>(CHECKOUT_CART, { cartId });\n return jsonResult(data.checkoutCart);\n } catch (error) {\n ctx.logger.error('store_cart_checkout failed', { error: String(error) });\n return errorResult(\n `Failed to checkout cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_clear')),\n {\n title: 'Clear Cart',\n description:\n \"Remove every item from the current user's active cart. Returns the resulting empty cart payload.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{\n clearCart: {\n cart: CartRow | null;\n errors: Array<{ code: string; field?: string; message: string }> | null;\n };\n }>(CLEAR_CART);\n const payload = data.clearCart;\n if (payload?.errors && payload.errors.length > 0) {\n const first = payload.errors[0];\n return errorResult(`Failed to clear cart: ${first.code} ${first.message}`);\n }\n return jsonResult(payload?.cart ?? null);\n } catch (error) {\n ctx.logger.error('store_cart_clear failed', { error: String(error) });\n return errorResult(\n `Failed to clear cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Orders ─────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_list')),\n {\n title: 'List Orders',\n description: 'List orders for the current user.',\n inputSchema: {\n limit: z.number().optional().describe('Page size (default 50)'),\n offset: z.number().optional().describe('Skip results (default 0)'),\n },\n },\n async ({ limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrders: OrderRow[] }>(GET_ORDERS, {\n limit,\n offset: offset ?? 0,\n });\n return jsonResult(data.getOrders);\n } catch (error) {\n ctx.logger.error('store_orders_list failed', { error: String(error) });\n return errorResult(\n `Failed to list orders: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_get')),\n {\n title: 'Get Order',\n description: 'Get an order by ID.',\n inputSchema: { id: z.string().describe('Order ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrder: OrderRow | null }>(GET_ORDER, { id });\n if (!data.getOrder) return errorResult(`Order ${id} not found`);\n return jsonResult(data.getOrder);\n } catch (error) {\n ctx.logger.error('store_orders_get failed', { error: String(error) });\n return errorResult(\n `Failed to get order: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Installed ──────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_list')),\n {\n title: 'List Installed Products',\n description: 'List installed products in the current (or specified) workspace.',\n inputSchema: {\n workspace: z.string().optional().describe('Workspace ID (defaults to current)'),\n },\n },\n async ({ workspace }) => {\n try {\n const wid = resolveWorkspaceId(ctx, workspace);\n if (!wid) {\n return errorResult(\n 'No active workspace. Bind a workspace via the auth login flow first.',\n );\n }\n const data = await ctx.gql.global.request<{\n getInstalledProducts: Array<{\n id: string;\n application: { id: string; name: string };\n status: string;\n installedAt: string;\n }>;\n }>(GET_INSTALLED_PRODUCTS, { workspaceId: wid });\n return jsonResult(data.getInstalledProducts);\n } catch (error) {\n ctx.logger.error('store_installed_list failed', { error: String(error) });\n return errorResult(\n `Failed to list installed products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_uninstall')),\n {\n title: 'Uninstall Product',\n description: 'Uninstall a product by installation ID.',\n inputSchema: { installationId: z.string().describe('Installation ID') },\n },\n async ({ installationId }) => {\n try {\n await ctx.gql.global.request(UNINSTALL_PRODUCT, { installationId });\n return jsonResult({ status: 'success', message: 'Product uninstalled', installationId });\n } catch (error) {\n ctx.logger.error('store_installed_uninstall failed', { error: String(error) });\n return errorResult(\n `Failed to uninstall product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Licenses ───────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_licenses_list')),\n {\n title: 'List Licenses',\n description: 'List licenses for an entitlement.',\n inputSchema: { entitlement: z.string().describe('Entitlement ID') },\n },\n async ({ entitlement }) => {\n try {\n const data = await ctx.gql.global.request<{\n getLicenses: Array<{ id: string; status: string; validFrom: string; expiresAt: string }>;\n }>(GET_LICENSES, { entitlementId: entitlement });\n return jsonResult(data.getLicenses);\n } catch (error) {\n ctx.logger.error('store_licenses_list failed', { error: String(error) });\n return errorResult(\n `Failed to list licenses: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Publisher ──────────────────────────────────────────────────────────\n // Schema reality: global-store-svc only exposes `myPublisher` (the current\n // user's own publisher profile). There is no public `getPublisher(id)` —\n // these tools target the bound user.\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_publisher_get')),\n {\n title: 'Get Publisher',\n description:\n \"Fetch the current user's publisher profile (verification status, tier, totals). Returns null if no publisher profile exists yet.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myPublisher: unknown | null }>(\n GET_MY_PUBLISHER,\n );\n return jsonResult(data.myPublisher);\n } catch (error) {\n ctx.logger.error('store_publisher_get failed', { error: String(error) });\n return errorResult(\n `Failed to get publisher: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_publisher_products')),\n {\n title: 'List Publisher Products',\n description:\n \"List products published by the current user's publisher profile. Returns { publisherId, productCount, products } or null if no profile exists.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{\n myPublisher: { id: string; productCount: number; products: StoreProduct[] } | null;\n }>(GET_MY_PUBLISHER_PRODUCTS);\n const p = data.myPublisher;\n if (!p) return jsonResult(null);\n return jsonResult({\n publisherId: p.id,\n productCount: p.productCount,\n products: p.products,\n });\n } catch (error) {\n ctx.logger.error('store_publisher_products failed', { error: String(error) });\n return errorResult(\n `Failed to list publisher products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Store module — marketplace search/browse, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerStoreTools } from './tools.js';\n\nconst storeModule: McpModule = {\n id: 'store',\n version: '0.0.1',\n displayName: 'Store',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerStoreTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default storeModule;\n"]}
@@ -101,6 +101,20 @@ var RESET_TOUR_PROGRESS = `
101
101
  }
102
102
  }
103
103
  `;
104
+ var COMPLETE_TOUR_STEP = `
105
+ mutation CompleteTourStep($tourId: ID!, $stepId: ID!, $userId: ID!) {
106
+ completeStep(tourId: $tourId, stepId: $stepId, userId: $userId) {
107
+ id
108
+ tourId
109
+ userId
110
+ status
111
+ currentStepId
112
+ currentStepOrder
113
+ completedSteps
114
+ lastViewedAt
115
+ }
116
+ }
117
+ `;
104
118
 
105
119
  // src/modules/tours/tools.ts
106
120
  function registerToursTools(server, ctx, track) {
@@ -167,6 +181,35 @@ function registerToursTools(server, ctx, track) {
167
181
  }
168
182
  }
169
183
  );
184
+ server.registerTool(
185
+ track(mcpToolName(ctx.productName, "tours_complete")),
186
+ {
187
+ title: "Complete Tour Step",
188
+ description: "Mark a tour step as completed for the given user. The user can only complete steps for themselves \u2014 the gateway rejects mismatched userId. Returns the updated UserTourProgress.",
189
+ inputSchema: {
190
+ tourId: zod.z.string().describe("Tour ID"),
191
+ stepId: zod.z.string().describe("Tour step ID"),
192
+ userId: zod.z.string().describe(
193
+ "User ID to mark the step completed for (must match the authenticated actor at the gateway)"
194
+ )
195
+ }
196
+ },
197
+ async ({ tourId, stepId, userId }) => {
198
+ try {
199
+ const data = await ctx.gql.global.request(COMPLETE_TOUR_STEP, {
200
+ tourId,
201
+ stepId,
202
+ userId
203
+ });
204
+ return jsonResult(data.completeStep);
205
+ } catch (error) {
206
+ ctx.logger.error("tours_complete failed", { error: String(error) });
207
+ return errorResult(
208
+ `Failed to complete tour step: ${error instanceof Error ? error.message : String(error)}`
209
+ );
210
+ }
211
+ }
212
+ );
170
213
  server.registerTool(
171
214
  track(mcpToolName(ctx.productName, "tours_progress_reset")),
172
215
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/result.ts","../../../src/core/tool-name.ts","../../../src/modules/tours/operations.ts","../../../src/modules/tours/tools.ts","../../../src/modules/tours/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,EAEzB,WAAA,CAAY,SAAiB,KAAA,EAAiB;AAC5C,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF,CAAA;;;ACCO,SAAS,UAAA,CAAW,MAAe,UAAA,EAAkD;AAC1F,EAAA,MAAM,MAAA,GAAqB;AAAA,IACzB,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,IAAA,EAAM,IAAA,EAAM,CAAC,CAAA,EAAG;AAAA,GACjE;AAIA,EAAA,OAAO,MAAA;AACT;AAaO,SAAS,WAAA,CAAY,SAAiB,IAAA,EAA2B;AACtE,EAAA,MAAM,IAAA,GAAO,IAAA,GAAO,CAAA,EAAG,OAAO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ACA,QAAA,OAAO,UAAA,CAAW,KAAK,iBAAiB,CAAA;AAAA,MAC1C,SAAS,KAAA,EAAO;AACd,QAAA,GAAA,CAAI,MAAA,CAAO,MAAM,6BAAA,EAA+B,EAAE,OAAO,MAAA,CAAO,KAAK,GAAG,CAAA;AACxE,QAAA,OAAO,WAAA;AAAA,UACL,kCAAkC,KAAA,YAAiB,KAAA,GAAQ,MAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,SAC1F;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;;;AC7FA,IAAM,WAAA,GAAyB;AAAA,EAC7B,EAAA,EAAI,OAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,OAAA;AAAA,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,kBAAA,CAAmB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n | { _meta?: { progressToken?: string | number } }\n | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n","export const LIST_TOURS = `\n query ListTours($filters: TourFilters, $pagination: TourPagination) {\n tours(filters: $filters, pagination: $pagination) {\n tours {\n id\n name\n slug\n description\n status\n isActive\n productId\n moduleId\n priority\n displayOrder\n createdAt\n updatedAt\n }\n total\n hasMore\n }\n }\n`;\n\nexport const GET_USER_TOUR_PROGRESS = `\n query GetUserTourProgress($userId: ID, $pagination: TourPagination) {\n userTourProgresses(userId: $userId, pagination: $pagination) {\n id\n tourId\n userId\n status\n currentStepId\n currentStepOrder\n completedSteps\n skippedSteps\n startedAt\n completedAt\n lastViewedAt\n }\n }\n`;\n\nexport const RESET_TOUR_PROGRESS = `\n mutation ResetTourProgress($tourId: ID!, $userId: ID!) {\n resetTourProgress(tourId: $tourId, userId: $userId) {\n id\n tourId\n status\n currentStepId\n currentStepOrder\n }\n }\n`;\n","import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport { LIST_TOURS, GET_USER_TOUR_PROGRESS, RESET_TOUR_PROGRESS } from './operations.js';\n\nexport function registerToursTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_list')),\n {\n title: 'List Tours',\n description: 'List available product tours.',\n inputSchema: {\n productId: z.string().optional().describe('Filter by productId'),\n moduleId: z.string().optional().describe('Filter by moduleId'),\n status: z.string().optional().describe('Filter by status'),\n isActive: z.boolean().optional().describe('Only active tours'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ productId, moduleId, status, isActive, limit, offset }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (productId !== undefined) filters.productId = productId;\n if (moduleId !== undefined) filters.moduleId = moduleId;\n if (status !== undefined) filters.status = status.toUpperCase();\n if (isActive !== undefined) filters.isActive = isActive;\n const data = await ctx.gql.global.request<{ tours: unknown }>(LIST_TOURS, {\n filters: Object.keys(filters).length ? filters : undefined,\n pagination: { limit: limit ?? 50, offset: offset ?? 0 },\n });\n return jsonResult(data.tours);\n } catch (error) {\n ctx.logger.error('tours_list failed', { error: String(error) });\n return errorResult(\n `Failed to list tours: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_progress_get')),\n {\n title: 'Get Tour Progress',\n description: \"Get the current user's tour progress, optionally filtered by user id.\",\n inputSchema: {\n userId: z.string().optional().describe('User ID (defaults to current actor)'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ userId, limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ userTourProgresses: unknown }>(\n GET_USER_TOUR_PROGRESS,\n {\n userId,\n pagination: { limit: limit ?? 50, offset: offset ?? 0 },\n },\n );\n return jsonResult(data.userTourProgresses);\n } catch (error) {\n ctx.logger.error('tours_progress_get failed', { error: String(error) });\n return errorResult(\n `Failed to get tour progress: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_progress_reset')),\n {\n title: 'Reset Tour Progress',\n description: 'Reset tour progress for the given user (defaults to the current actor).',\n inputSchema: {\n tourId: z.string().describe('Tour ID'),\n userId: z.string().optional().describe('User ID (defaults to current actor)'),\n },\n },\n async ({ tourId, userId }) => {\n try {\n const auth = ctx.auth.read();\n const resolvedUserId = userId ?? auth?.workspaceId;\n if (!resolvedUserId) {\n return errorResult(\n 'Unable to resolve user; pass userId or authenticate to a workspace first.',\n );\n }\n const data = await ctx.gql.global.request<{ resetTourProgress: unknown }>(\n RESET_TOUR_PROGRESS,\n { tourId, userId: resolvedUserId },\n );\n return jsonResult(data.resetTourProgress);\n } catch (error) {\n ctx.logger.error('tours_progress_reset failed', { error: String(error) });\n return errorResult(\n `Failed to reset tour progress: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Tours module — product tours + per-user progress.\n *\n * Tools:\n * <product>_tours_list\n * <product>_tours_progress_{get,reset}\n *\n * Backend: ~/products/global/tours/global-tours-svc/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerToursTools } from './tools.js';\n\nconst toursModule: McpModule = {\n id: 'tours',\n version: '0.0.1',\n displayName: 'Tours',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerToursTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default toursModule;\n"]}
1
+ {"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/result.ts","../../../src/core/tool-name.ts","../../../src/modules/tours/operations.ts","../../../src/modules/tours/tools.ts","../../../src/modules/tours/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,EAEzB,WAAA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KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n | { _meta?: { progressToken?: string | number } }\n | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n","export const LIST_TOURS = `\n query ListTours($filters: TourFilters, $pagination: TourPagination) {\n tours(filters: $filters, pagination: $pagination) {\n tours {\n id\n name\n slug\n description\n status\n isActive\n productId\n moduleId\n priority\n displayOrder\n createdAt\n updatedAt\n }\n total\n hasMore\n }\n }\n`;\n\nexport const GET_USER_TOUR_PROGRESS = `\n query GetUserTourProgress($userId: ID, $pagination: TourPagination) {\n userTourProgresses(userId: $userId, pagination: $pagination) {\n id\n tourId\n userId\n status\n currentStepId\n currentStepOrder\n completedSteps\n skippedSteps\n startedAt\n completedAt\n lastViewedAt\n }\n }\n`;\n\nexport const RESET_TOUR_PROGRESS = `\n mutation ResetTourProgress($tourId: ID!, $userId: ID!) {\n resetTourProgress(tourId: $tourId, userId: $userId) {\n id\n tourId\n status\n currentStepId\n currentStepOrder\n }\n }\n`;\n\nexport const COMPLETE_TOUR_STEP = `\n mutation CompleteTourStep($tourId: ID!, $stepId: ID!, $userId: ID!) {\n completeStep(tourId: $tourId, stepId: $stepId, userId: $userId) {\n id\n tourId\n userId\n status\n currentStepId\n currentStepOrder\n completedSteps\n lastViewedAt\n }\n }\n`;\n","import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n LIST_TOURS,\n GET_USER_TOUR_PROGRESS,\n RESET_TOUR_PROGRESS,\n COMPLETE_TOUR_STEP,\n} from './operations.js';\n\nexport function registerToursTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_list')),\n {\n title: 'List Tours',\n description: 'List available product tours.',\n inputSchema: {\n productId: z.string().optional().describe('Filter by productId'),\n moduleId: z.string().optional().describe('Filter by moduleId'),\n status: z.string().optional().describe('Filter by status'),\n isActive: z.boolean().optional().describe('Only active tours'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ productId, moduleId, status, isActive, limit, offset }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (productId !== undefined) filters.productId = productId;\n if (moduleId !== undefined) filters.moduleId = moduleId;\n if (status !== undefined) filters.status = status.toUpperCase();\n if (isActive !== undefined) filters.isActive = isActive;\n const data = await ctx.gql.global.request<{ tours: unknown }>(LIST_TOURS, {\n filters: Object.keys(filters).length ? filters : undefined,\n pagination: { limit: limit ?? 50, offset: offset ?? 0 },\n });\n return jsonResult(data.tours);\n } catch (error) {\n ctx.logger.error('tours_list failed', { error: String(error) });\n return errorResult(\n `Failed to list tours: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_progress_get')),\n {\n title: 'Get Tour Progress',\n description: \"Get the current user's tour progress, optionally filtered by user id.\",\n inputSchema: {\n userId: z.string().optional().describe('User ID (defaults to current actor)'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ userId, limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ userTourProgresses: unknown }>(\n GET_USER_TOUR_PROGRESS,\n {\n userId,\n pagination: { limit: limit ?? 50, offset: offset ?? 0 },\n },\n );\n return jsonResult(data.userTourProgresses);\n } catch (error) {\n ctx.logger.error('tours_progress_get failed', { error: String(error) });\n return errorResult(\n `Failed to get tour progress: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_complete')),\n {\n title: 'Complete Tour Step',\n description:\n 'Mark a tour step as completed for the given user. The user can only complete steps for themselves — the gateway rejects mismatched userId. Returns the updated UserTourProgress.',\n inputSchema: {\n tourId: z.string().describe('Tour ID'),\n stepId: z.string().describe('Tour step ID'),\n userId: z\n .string()\n .describe(\n 'User ID to mark the step completed for (must match the authenticated actor at the gateway)',\n ),\n },\n },\n async ({ tourId, stepId, userId }) => {\n try {\n const data = await ctx.gql.global.request<{ completeStep: unknown }>(COMPLETE_TOUR_STEP, {\n tourId,\n stepId,\n userId,\n });\n return jsonResult(data.completeStep);\n } catch (error) {\n ctx.logger.error('tours_complete failed', { error: String(error) });\n return errorResult(\n `Failed to complete tour step: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_progress_reset')),\n {\n title: 'Reset Tour Progress',\n description: 'Reset tour progress for the given user (defaults to the current actor).',\n inputSchema: {\n tourId: z.string().describe('Tour ID'),\n userId: z.string().optional().describe('User ID (defaults to current actor)'),\n },\n },\n async ({ tourId, userId }) => {\n try {\n const auth = ctx.auth.read();\n const resolvedUserId = userId ?? auth?.workspaceId;\n if (!resolvedUserId) {\n return errorResult(\n 'Unable to resolve user; pass userId or authenticate to a workspace first.',\n );\n }\n const data = await ctx.gql.global.request<{ resetTourProgress: unknown }>(\n RESET_TOUR_PROGRESS,\n { tourId, userId: resolvedUserId },\n );\n return jsonResult(data.resetTourProgress);\n } catch (error) {\n ctx.logger.error('tours_progress_reset failed', { error: String(error) });\n return errorResult(\n `Failed to reset tour progress: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Tours module — product tours + per-user progress.\n *\n * Tools:\n * <product>_tours_list\n * <product>_tours_progress_{get,reset}\n *\n * Backend: ~/products/global/tours/global-tours-svc/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerToursTools } from './tools.js';\n\nconst toursModule: McpModule = {\n id: 'tours',\n version: '0.0.1',\n displayName: 'Tours',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerToursTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default toursModule;\n"]}
@@ -52,6 +52,20 @@ var RESET_TOUR_PROGRESS = `
52
52
  }
53
53
  }
54
54
  `;
55
+ var COMPLETE_TOUR_STEP = `
56
+ mutation CompleteTourStep($tourId: ID!, $stepId: ID!, $userId: ID!) {
57
+ completeStep(tourId: $tourId, stepId: $stepId, userId: $userId) {
58
+ id
59
+ tourId
60
+ userId
61
+ status
62
+ currentStepId
63
+ currentStepOrder
64
+ completedSteps
65
+ lastViewedAt
66
+ }
67
+ }
68
+ `;
55
69
 
56
70
  // src/modules/tours/tools.ts
57
71
  function registerToursTools(server, ctx, track) {
@@ -118,6 +132,35 @@ function registerToursTools(server, ctx, track) {
118
132
  }
119
133
  }
120
134
  );
135
+ server.registerTool(
136
+ track(mcpToolName(ctx.productName, "tours_complete")),
137
+ {
138
+ title: "Complete Tour Step",
139
+ description: "Mark a tour step as completed for the given user. The user can only complete steps for themselves \u2014 the gateway rejects mismatched userId. Returns the updated UserTourProgress.",
140
+ inputSchema: {
141
+ tourId: z.string().describe("Tour ID"),
142
+ stepId: z.string().describe("Tour step ID"),
143
+ userId: z.string().describe(
144
+ "User ID to mark the step completed for (must match the authenticated actor at the gateway)"
145
+ )
146
+ }
147
+ },
148
+ async ({ tourId, stepId, userId }) => {
149
+ try {
150
+ const data = await ctx.gql.global.request(COMPLETE_TOUR_STEP, {
151
+ tourId,
152
+ stepId,
153
+ userId
154
+ });
155
+ return jsonResult(data.completeStep);
156
+ } catch (error) {
157
+ ctx.logger.error("tours_complete failed", { error: String(error) });
158
+ return errorResult(
159
+ `Failed to complete tour step: ${error instanceof Error ? error.message : String(error)}`
160
+ );
161
+ }
162
+ }
163
+ );
121
164
  server.registerTool(
122
165
  track(mcpToolName(ctx.productName, "tours_progress_reset")),
123
166
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/modules/tours/operations.ts","../../../src/modules/tours/tools.ts","../../../src/modules/tours/index.ts"],"names":[],"mappings":";;;;AAAO,IAAM,UAAA,GAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAuBnB,IAAM,sBAAA,GAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAkB/B,IAAM,mBAAA,GAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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A;AAAA,UAChC,mBAAA;AAAA,UACA,EAAE,MAAA,EAAQ,MAAA,EAAQ,cAAA;AAAe,SACnC;AACA,QAAA,OAAO,UAAA,CAAW,KAAK,iBAAiB,CAAA;AAAA,MAC1C,SAAS,KAAA,EAAO;AACd,QAAA,GAAA,CAAI,MAAA,CAAO,MAAM,6BAAA,EAA+B,EAAE,OAAO,MAAA,CAAO,KAAK,GAAG,CAAA;AACxE,QAAA,OAAO,WAAA;AAAA,UACL,kCAAkC,KAAA,YAAiB,KAAA,GAAQ,MAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,SAC1F;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;;;AC7FA,IAAM,WAAA,GAAyB;AAAA,EAC7B,EAAA,EAAI,OAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,OAAA;AAAA,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,kBAAA,CAAmB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["export const LIST_TOURS = `\n query ListTours($filters: TourFilters, $pagination: TourPagination) {\n tours(filters: $filters, pagination: $pagination) {\n tours {\n id\n name\n slug\n description\n status\n isActive\n productId\n moduleId\n priority\n displayOrder\n createdAt\n updatedAt\n }\n total\n hasMore\n }\n }\n`;\n\nexport const GET_USER_TOUR_PROGRESS = `\n query GetUserTourProgress($userId: ID, $pagination: TourPagination) {\n userTourProgresses(userId: $userId, pagination: $pagination) {\n id\n tourId\n userId\n status\n currentStepId\n currentStepOrder\n completedSteps\n skippedSteps\n startedAt\n completedAt\n lastViewedAt\n }\n }\n`;\n\nexport const RESET_TOUR_PROGRESS = `\n mutation ResetTourProgress($tourId: ID!, $userId: ID!) {\n resetTourProgress(tourId: $tourId, userId: $userId) {\n id\n tourId\n status\n currentStepId\n currentStepOrder\n }\n }\n`;\n","import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport { LIST_TOURS, GET_USER_TOUR_PROGRESS, RESET_TOUR_PROGRESS } from './operations.js';\n\nexport function registerToursTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_list')),\n {\n title: 'List Tours',\n description: 'List available product tours.',\n inputSchema: {\n productId: z.string().optional().describe('Filter by productId'),\n moduleId: z.string().optional().describe('Filter by moduleId'),\n status: z.string().optional().describe('Filter by status'),\n isActive: z.boolean().optional().describe('Only active tours'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ productId, moduleId, status, isActive, limit, offset }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (productId !== undefined) filters.productId = productId;\n if (moduleId !== undefined) filters.moduleId = moduleId;\n if (status !== undefined) filters.status = status.toUpperCase();\n if (isActive !== undefined) filters.isActive = isActive;\n const data = await ctx.gql.global.request<{ tours: unknown }>(LIST_TOURS, {\n filters: Object.keys(filters).length ? filters : undefined,\n pagination: { limit: limit ?? 50, offset: offset ?? 0 },\n });\n return jsonResult(data.tours);\n } catch (error) {\n ctx.logger.error('tours_list failed', { error: String(error) });\n return errorResult(\n `Failed to list tours: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_progress_get')),\n {\n title: 'Get Tour Progress',\n description: \"Get the current user's tour progress, optionally filtered by user id.\",\n inputSchema: {\n userId: z.string().optional().describe('User ID (defaults to current actor)'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ userId, limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ userTourProgresses: unknown }>(\n GET_USER_TOUR_PROGRESS,\n {\n userId,\n pagination: { limit: limit ?? 50, offset: offset ?? 0 },\n },\n );\n return jsonResult(data.userTourProgresses);\n } catch (error) {\n ctx.logger.error('tours_progress_get failed', { error: String(error) });\n return errorResult(\n `Failed to get tour progress: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_progress_reset')),\n {\n title: 'Reset Tour Progress',\n description: 'Reset tour progress for the given user (defaults to the current actor).',\n inputSchema: {\n tourId: z.string().describe('Tour ID'),\n userId: z.string().optional().describe('User ID (defaults to current actor)'),\n },\n },\n async ({ tourId, userId }) => {\n try {\n const auth = ctx.auth.read();\n const resolvedUserId = userId ?? auth?.workspaceId;\n if (!resolvedUserId) {\n return errorResult(\n 'Unable to resolve user; pass userId or authenticate to a workspace first.',\n );\n }\n const data = await ctx.gql.global.request<{ resetTourProgress: unknown }>(\n RESET_TOUR_PROGRESS,\n { tourId, userId: resolvedUserId },\n );\n return jsonResult(data.resetTourProgress);\n } catch (error) {\n ctx.logger.error('tours_progress_reset failed', { error: String(error) });\n return errorResult(\n `Failed to reset tour progress: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Tours module — product tours + per-user progress.\n *\n * Tools:\n * <product>_tours_list\n * <product>_tours_progress_{get,reset}\n *\n * Backend: ~/products/global/tours/global-tours-svc/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerToursTools } from './tools.js';\n\nconst toursModule: McpModule = {\n id: 'tours',\n version: '0.0.1',\n displayName: 'Tours',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerToursTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default toursModule;\n"]}
1
+ {"version":3,"sources":["../../../src/modules/tours/operations.ts","../../../src/modules/tours/tools.ts","../../../src/modules/tours/index.ts"],"names":[],"mappings":";;;;AAAO,IAAM,UAAA,GAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAuBnB,IAAM,sBAAA,GAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAkB/B,IAAM,mBAAA,GAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAY5B,IAAM,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;;;AC3C3B,SAAS,kBAAA,CACd,MAAA,EACA,GAAA,EACA,KAAA,EACM;AACN,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,KAAA,CAAM,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,YAAY,CAAC,CAAA;AAAA,IAChD;AAAA,MACE,KAAA,EAAO,YAAA;AAAA,MACP,WAAA,EAAa,+BAAA;AAAA,MACb,WAAA,EAAa;AAAA,QACX,WAAW,CAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAAE,SAAS,qB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,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,kBAAA,CAAmB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["export const LIST_TOURS = `\n query ListTours($filters: TourFilters, $pagination: TourPagination) {\n tours(filters: $filters, pagination: $pagination) {\n tours {\n id\n name\n slug\n description\n status\n isActive\n productId\n moduleId\n priority\n displayOrder\n createdAt\n updatedAt\n }\n total\n hasMore\n }\n }\n`;\n\nexport const GET_USER_TOUR_PROGRESS = `\n query GetUserTourProgress($userId: ID, $pagination: TourPagination) {\n userTourProgresses(userId: $userId, pagination: $pagination) {\n id\n tourId\n userId\n status\n currentStepId\n currentStepOrder\n completedSteps\n skippedSteps\n startedAt\n completedAt\n lastViewedAt\n }\n }\n`;\n\nexport const RESET_TOUR_PROGRESS = `\n mutation ResetTourProgress($tourId: ID!, $userId: ID!) {\n resetTourProgress(tourId: $tourId, userId: $userId) {\n id\n tourId\n status\n currentStepId\n currentStepOrder\n }\n }\n`;\n\nexport const COMPLETE_TOUR_STEP = `\n mutation CompleteTourStep($tourId: ID!, $stepId: ID!, $userId: ID!) {\n completeStep(tourId: $tourId, stepId: $stepId, userId: $userId) {\n id\n tourId\n userId\n status\n currentStepId\n currentStepOrder\n completedSteps\n lastViewedAt\n }\n }\n`;\n","import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n LIST_TOURS,\n GET_USER_TOUR_PROGRESS,\n RESET_TOUR_PROGRESS,\n COMPLETE_TOUR_STEP,\n} from './operations.js';\n\nexport function registerToursTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_list')),\n {\n title: 'List Tours',\n description: 'List available product tours.',\n inputSchema: {\n productId: z.string().optional().describe('Filter by productId'),\n moduleId: z.string().optional().describe('Filter by moduleId'),\n status: z.string().optional().describe('Filter by status'),\n isActive: z.boolean().optional().describe('Only active tours'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ productId, moduleId, status, isActive, limit, offset }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (productId !== undefined) filters.productId = productId;\n if (moduleId !== undefined) filters.moduleId = moduleId;\n if (status !== undefined) filters.status = status.toUpperCase();\n if (isActive !== undefined) filters.isActive = isActive;\n const data = await ctx.gql.global.request<{ tours: unknown }>(LIST_TOURS, {\n filters: Object.keys(filters).length ? filters : undefined,\n pagination: { limit: limit ?? 50, offset: offset ?? 0 },\n });\n return jsonResult(data.tours);\n } catch (error) {\n ctx.logger.error('tours_list failed', { error: String(error) });\n return errorResult(\n `Failed to list tours: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_progress_get')),\n {\n title: 'Get Tour Progress',\n description: \"Get the current user's tour progress, optionally filtered by user id.\",\n inputSchema: {\n userId: z.string().optional().describe('User ID (defaults to current actor)'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Offset for pagination'),\n },\n },\n async ({ userId, limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ userTourProgresses: unknown }>(\n GET_USER_TOUR_PROGRESS,\n {\n userId,\n pagination: { limit: limit ?? 50, offset: offset ?? 0 },\n },\n );\n return jsonResult(data.userTourProgresses);\n } catch (error) {\n ctx.logger.error('tours_progress_get failed', { error: String(error) });\n return errorResult(\n `Failed to get tour progress: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_complete')),\n {\n title: 'Complete Tour Step',\n description:\n 'Mark a tour step as completed for the given user. The user can only complete steps for themselves — the gateway rejects mismatched userId. Returns the updated UserTourProgress.',\n inputSchema: {\n tourId: z.string().describe('Tour ID'),\n stepId: z.string().describe('Tour step ID'),\n userId: z\n .string()\n .describe(\n 'User ID to mark the step completed for (must match the authenticated actor at the gateway)',\n ),\n },\n },\n async ({ tourId, stepId, userId }) => {\n try {\n const data = await ctx.gql.global.request<{ completeStep: unknown }>(COMPLETE_TOUR_STEP, {\n tourId,\n stepId,\n userId,\n });\n return jsonResult(data.completeStep);\n } catch (error) {\n ctx.logger.error('tours_complete failed', { error: String(error) });\n return errorResult(\n `Failed to complete tour step: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'tours_progress_reset')),\n {\n title: 'Reset Tour Progress',\n description: 'Reset tour progress for the given user (defaults to the current actor).',\n inputSchema: {\n tourId: z.string().describe('Tour ID'),\n userId: z.string().optional().describe('User ID (defaults to current actor)'),\n },\n },\n async ({ tourId, userId }) => {\n try {\n const auth = ctx.auth.read();\n const resolvedUserId = userId ?? auth?.workspaceId;\n if (!resolvedUserId) {\n return errorResult(\n 'Unable to resolve user; pass userId or authenticate to a workspace first.',\n );\n }\n const data = await ctx.gql.global.request<{ resetTourProgress: unknown }>(\n RESET_TOUR_PROGRESS,\n { tourId, userId: resolvedUserId },\n );\n return jsonResult(data.resetTourProgress);\n } catch (error) {\n ctx.logger.error('tours_progress_reset failed', { error: String(error) });\n return errorResult(\n `Failed to reset tour progress: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Tours module — product tours + per-user progress.\n *\n * Tools:\n * <product>_tours_list\n * <product>_tours_progress_{get,reset}\n *\n * Backend: ~/products/global/tours/global-tours-svc/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerToursTools } from './tools.js';\n\nconst toursModule: McpModule = {\n id: 'tours',\n version: '0.0.1',\n displayName: 'Tours',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerToursTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default toursModule;\n"]}