@burdenoff/mcp-libs 2026.1110.2 → 2026.1110.3

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/tool-name.ts","../../../src/core/result.ts","../../../src/modules/bigconsole/operations.ts","../../../src/modules/bigconsole/tools/shared.ts","../../../src/modules/bigconsole/tools/dashboards.ts","../../../src/modules/bigconsole/tools/datasinks.ts","../../../src/modules/bigconsole/tools/generate.ts","../../../src/modules/bigconsole/tools/parsers.ts","../../../src/modules/bigconsole/tools/widgets.ts","../../../src/modules/bigconsole/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;;;AC1BA,IAAM,oBAAA,GAAuB,EAAA;AAE7B,SAAS,cAAA,CAAe,MAAc,IAAA,EAA8C;AAClF,EAAA,IAAuB,IAAA,CAAK,MAAA,GAAS,oBAAA,EAAsB;AACzD,IAAA,MAAM,IAAI,gBAAA;AAAA,MACR,CAAA,WAAA,EAAc,IAAI,CAAA,UAAA,EAAa,oBAAoB,CAAA,8CAAA;AAAA,KACrD;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT;AAMO,SAAS,WAAA,CAAY,gBAAwB,KAAA,EAAyB;AAC3E,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,MAAM,IAAI,iBAAiB,sCAAsC,CAAA;AAAA,EACnE;AACA,EAAA,MAAM,IAAA,GAAO,CAAC,WAAA,EAAa,GAAG,KAAK,EAAE,MAAA,CAAO,OAAO,CAAA,C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M,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,qBAAA,CAAsB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACxC,IAAA,sBAAA,CAAuB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACzC,IAAA,mBAAA,CAAoB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACtC,IAAA,mBAAA,CAAoB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACtC,IAAA,qBAAA,CAAsB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAExC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,kBAAA,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 * 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\n/**\n * Name-based hint heuristics for MCP `annotations` (readOnlyHint /\n * destructiveHint). Used by tool-governance.ts to auto-fill annotations for\n * the fleet of product modules that call `server.registerTool` directly\n * (bypassing the `registerTool()` core helper) and so never set them\n * explicitly today (BOFF-3903). Deliberately conservative — matched against\n * whole `_`-delimited segments so e.g. `timeentries_delete` and\n * `pomodoro_delete_goal` match, but a hypothetical `undeletable_check`\n * would not.\n *\n * The destructive verb set covers more than `delete`: stopping, killing or\n * terminating a running process, revoking or rotating a credential/share,\n * resetting settings and removing/purging/uninstalling are all actions an\n * MCP client must not auto-run without the user's intent (VC/FG parity G57 —\n * e.g. `vibecontrols_sessions_kill`, `vibecontrols_tunnels_rotate_credentials`\n * were previously reported as non-destructive).\n *\n * A module can always override the inference by passing an explicit\n * `annotations` object to `registerTool()` / `server.registerTool()` — do\n * that for the rare verb match that is harmless (e.g. a typing indicator's\n * `typing_stop`).\n */\nexport const DESTRUCTIVE_NAME_VERBS = [\n 'delete',\n 'destroy',\n 'erase',\n 'kill',\n 'purge',\n 'remove',\n 'reset',\n 'revoke',\n 'rotate',\n 'stop',\n 'terminate',\n 'uninstall',\n 'wipe',\n] as const;\nconst DESTRUCTIVE_NAME_SEGMENT = new RegExp(\n `(?:^|_)(?:${DESTRUCTIVE_NAME_VERBS.join('|')})(?:_|$)`,\n 'i',\n);\nconst READ_ONLY_NAME_SEGMENT = /(?:^|_)(?:list|get|search|check|read|count|stats|by_date)(?:_|$)/i;\n\n/** True when a tool name looks destructive (irreversibly deletes data) by naming convention. */\nexport function inferDestructiveHint(toolName: string): boolean {\n return DESTRUCTIVE_NAME_SEGMENT.test(toolName);\n}\n\n/**\n * True when a tool name looks read-only by naming convention. Never true for\n * a name that also looks destructive (a tool can't be both).\n */\nexport function inferReadOnlyHint(toolName: string): boolean {\n return !inferDestructiveHint(toolName) && READ_ONLY_NAME_SEGMENT.test(toolName);\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';\nimport type { ToolAnnotations } from './tool-governance.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 * Explicit MCP annotations (readOnlyHint / destructiveHint / ...). Optional\n * — when omitted, `wrapServerWithToolGovernance` (applied centrally in\n * `createMcpServer`) infers them from the tool name. Set this to override\n * the inference for a tool whose name doesn't match the naming convention.\n */\n annotations?: ToolAnnotations;\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 ...(metadata.annotations ? { annotations: metadata.annotations } : {}),\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 } } | 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 * Centralized GraphQL operations for the BigConsole MCP module (BOFF-3729).\n *\n * Backend subgraph: ~/products/wspace/bigconsole/wspace-bigconsole-svc/\n * (Hive service name `bigconsole`). Every operation here runs against the\n * WORKSPACE PUBLIC gateway, which is the only place `@rbac` is enforced from\n * the composed supergraph. This module authorises nothing itself and never\n * sees a token — `ctx.gql.workspace` injects the session's auth headers\n * (app-client-credentials or device-code login) plus the `x-workspace-id`\n * header set by `auth_select_workspace`.\n *\n * ### Selection sets are deliberately slim (BOFF-2719 / BOFF-2720)\n *\n * The gateway enforces a query-cost limit (`ARMOR_VIOLATION`) that fat\n * selection sets on `listDashboards` / `getDashboard` / `createDashboard`-\n * adjacent reads have tripped in production. So:\n *\n * - list queries select ids/keys/names and scalar metadata only — never\n * nested widget `config`, never `data` payloads;\n * - a widget's full `config` is only ever fetched for a single widget being\n * edited, and v1 ships no widget-config read at all;\n * - `getDataSink` never selects `data` (the payload can be arbitrarily large).\n *\n * Every operation name, argument and selected field below was verified\n * against the subgraph's `.hive-schema.graphql` — not assumed from naming.\n *\n * Uses template-string interpolation (not gql tagged fragments) to match the\n * canonical healthybowl / kadaikodi module operations files.\n */\n\n// ---------------------------------------------------------------------------\n// DataSinks\n// ---------------------------------------------------------------------------\n\nexport const LIST_DATA_SINKS = `\n query BigConsoleMcpListDataSinks($first: Int, $after: String, $search: String, $status: DataSinkStatus) {\n listDataSinks(first: $first, after: $after, search: $search, status: $status) {\n edges {\n node {\n id\n key\n name\n description\n status\n isActive\n setupState\n ttl\n version\n lastRefreshedAt\n updatedAt\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\nexport const GET_DATA_SINK = `\n query BigConsoleMcpGetDataSink($id: ID, $key: String) {\n getDataSink(id: $id, key: $key) {\n id\n key\n name\n description\n status\n isActive\n setupState\n dataClassification\n fieldMaskingEnabled\n ttl\n version\n linkedParserCount\n createdAt\n updatedAt\n lastRefreshedAt\n }\n }\n`;\n\nexport const CREATE_DATA_SINK = `\n mutation BigConsoleMcpCreateDataSink($input: CreateDataSinkInput!) {\n createDataSink(input: $input) {\n id\n key\n name\n status\n version\n }\n }\n`;\n\nexport const UPDATE_DATA_SINK = `\n mutation BigConsoleMcpUpdateDataSink($input: UpdateDataSinkInput!) {\n updateDataSink(input: $input) {\n id\n key\n name\n version\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Dashboards (consoles) + pages\n// ---------------------------------------------------------------------------\n\nexport const LIST_DASHBOARDS = `\n query BigConsoleMcpListDashboards(\n $first: Int\n $after: String\n $search: String\n $category: BigConsoleDashboardCategory\n $visibility: BigConsoleDashboardVisibility\n $includeArchived: Boolean\n ) {\n listDashboards(\n first: $first\n after: $after\n search: $search\n category: $category\n visibility: $visibility\n includeArchived: $includeArchived\n ) {\n edges {\n node {\n id\n name\n description\n category\n visibility\n status\n isArchived\n pageCount\n widgetCount\n updatedAt\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\nexport const GET_DASHBOARD = `\n query BigConsoleMcpGetDashboard($id: ID!) {\n getDashboard(id: $id) {\n id\n name\n description\n category\n visibility\n status\n isArchived\n pageCount\n widgetCount\n publishedAt\n globalFilters {\n id\n name\n type\n dependsOn\n }\n pages(first: 20) {\n edges {\n node {\n id\n name\n order\n widgetCount\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n }\n }\n }\n }\n`;\n\nexport const CREATE_DASHBOARD = `\n mutation BigConsoleMcpCreateDashboard($input: BigConsoleCreateDashboardInput!) {\n createBigConsoleDashboard(input: $input) {\n id\n name\n category\n visibility\n status\n pageCount\n }\n }\n`;\n\nexport const CREATE_DASHBOARD_PAGE = `\n mutation BigConsoleMcpCreateDashboardPage($input: BigConsoleCreateDashboardPageInput!) {\n createDashboardPage(input: $input) {\n id\n name\n dashboardId\n order\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Parsers\n// ---------------------------------------------------------------------------\n\nexport const LIST_PARSERS = `\n query BigConsoleMcpListParsers($consoleId: ID!, $first: Int, $after: String) {\n listParsers(filter: { consoleId: $consoleId }, first: $first, after: $after) {\n edges {\n node {\n id\n name\n type\n status\n inputSinkKey\n outputKey\n version\n updatedAt\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\nexport const CREATE_PARSER = `\n mutation BigConsoleMcpCreateParser($input: CreateParserInput!) {\n createParser(input: $input) {\n id\n name\n type\n status\n inputSinkKey\n outputKey\n version\n }\n }\n`;\n\nexport const UPDATE_PARSER = `\n mutation BigConsoleMcpUpdateParser($id: ID!, $input: UpdateParserInput!, $version: Int!) {\n updateParser(id: $id, input: $input, version: $version) {\n id\n name\n type\n status\n inputSinkKey\n outputKey\n version\n }\n }\n`;\n\nexport const TEST_PARSER_EXPRESSION = `\n query BigConsoleMcpTestParserExpression($input: TestParserInput!) {\n testParserExpression(input: $input) {\n success\n output\n error\n executionTimeMs\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Widgets\n// ---------------------------------------------------------------------------\n\nexport const CREATE_WIDGET = `\n mutation BigConsoleMcpCreateWidget($input: BigConsoleCreateWidgetInput!) {\n createBigConsoleWidget(input: $input) {\n id\n title\n type\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Export / import — the Console Definition JSON round-trip\n// ---------------------------------------------------------------------------\n\nexport const EXPORT_DASHBOARD = `\n query BigConsoleMcpExportDashboard($id: ID!, $options: BigConsoleExportDashboardOptions) {\n exportDashboard(id: $id, options: $options)\n }\n`;\n\n/**\n * Import is the v2.0 path (`importBigConsoleDashboard`), NOT the legacy\n * `importDashboard` mutation: the export QUERY emits schemaVersion \"1.0\"\n * with `pages` at the TOP level of the document, while the legacy v1\n * mutation reads `dashboard.pages` (the deprecated v1 export-mutation\n * layout) and silently imports an EMPTY dashboard from a v2 export. The v2\n * mutation is the verified round-trip partner of `exportDashboard` and\n * reports per-entity stats (pages/widgets/actions/filters created).\n */\nexport const IMPORT_DASHBOARD = `\n mutation BigConsoleMcpImportDashboard($input: ImportBigConsoleDashboardInput!) {\n importBigConsoleDashboard(input: $input) {\n success\n errorMessage\n dashboard {\n id\n name\n pageCount\n widgetCount\n }\n stats {\n pagesCreated\n widgetsCreated\n actionsCreated\n filtersCreated\n dataSourcesSkipped\n }\n }\n }\n`;\n\n/**\n * Validate an import WITHOUT creating anything. importBigConsoleDashboard\n * refuses (success: false) when the definition carries non-blocking warnings\n * until the caller passes skipWarnings: true — the agent needs the warning\n * text to make that call, and this query is how it reads them.\n */\nexport const VALIDATE_DASHBOARD_IMPORT = `\n query BigConsoleMcpValidateDashboardImport($content: String!) {\n validateDashboardImport(content: $content) {\n isValid\n dashboardInfo {\n name\n pageCount\n widgetCount\n schemaVersion\n }\n errors {\n code\n message\n path\n }\n warnings {\n code\n message\n suggestion\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Generate-from-prompt lifecycle\n// ---------------------------------------------------------------------------\n\nexport const GENERATE_DASHBOARD_FROM_PROMPT = `\n mutation BigConsoleMcpGenerateDashboardFromPrompt($input: BigConsoleGenerateDashboardFromPromptInput!) {\n generateDashboardFromPrompt(input: $input) {\n id\n status\n }\n }\n`;\n\nexport const GET_PROMPT_GENERATION = `\n query BigConsoleMcpGetPromptGeneration($id: ID!) {\n getPromptGeneration(id: $id) {\n id\n status\n errorMessage\n generatedSpecDigest\n dashboardId\n }\n }\n`;\n\nexport const CREATE_DASHBOARD_FROM_GENERATION = `\n mutation BigConsoleMcpCreateDashboardFromGeneration($input: BigConsoleCreateDashboardFromGenerationInput!) {\n createDashboardFromGeneration(input: $input) {\n id\n name\n pageCount\n widgetCount\n }\n }\n`;\n","/**\n * Shared zod shapes + guardrails for the BigConsole tool surface.\n *\n * ### No tool here takes a workspace or a token\n *\n * `@rbac(scopeType: \"wspace\")` authorises the workspace named in the\n * `x-workspace-id` gateway header — the one `auth_select_workspace` sets — and\n * nothing else. BigConsole's inputs carry no workspace field at all, so there\n * is nothing to expose. Likewise no tool takes a token: the session's\n * credential (app-client-credentials or device-code login) is injected by\n * `ctx.gql.workspace` from the auth store, and a tool-level token input would\n * be a forwarded-user-token hole (AI_READINESS §2.1).\n *\n * ### The two footguns are encoded here, not in documentation\n *\n * 1. **The nine render-verified widget types.** Since BOFF-3550 every native\n * `BigConsoleWidgetType` member passes the gateway enum, but `config` is\n * opaque JSON and the renderer is the only judge — the v2.0-internal\n * lowercase keys (`kanban`, `pivot_table`, …) and the native types without\n * documented configs render wrong or not at all. The allowlist below is\n * the nine render-verified members; anything else is rejected client-side\n * with a message that names all nine.\n * 2. **Optimistic locking.** `updateDataSink` carries `version` inside the\n * input; `updateParser` takes it as a top-level argument. Both are\n * required `Int` tool inputs — a caller must read the current version\n * first (every read selects it) and send it back unchanged.\n *\n * @module bigconsole\n */\n\nimport { z } from 'zod';\n\n/** Appended to every tool description so the failure mode is stated where it will be read. */\nexport const WORKSPACE_NOTE =\n 'Operates on the workspace selected via auth_select_workspace — this tool takes no workspace ' +\n 'or token argument. Authorization is enforced at the gateway from the authenticated session.';\n\n// ── The nine render-verified widget types ───────────────────────────────────\n\nexport const WIDGET_TYPES = [\n 'LINE_CHART',\n 'BAR_CHART',\n 'AREA_CHART',\n 'PIE_CHART',\n 'TABLE',\n 'KPI',\n 'HEATMAP',\n 'FUNNEL',\n 'RETENTION',\n] as const;\n\nexport const WIDGET_TYPE_LIST = WIDGET_TYPES.join(', ');\n\nconst WIDGET_TYPE_REJECTION = (value: string): string =>\n `\"${value}\" is not a render-verified BigConsole widget type. This tool accepts exactly the nine ` +\n `render-verified types: ${WIDGET_TYPE_LIST}. (Since BOFF-3550 the gateway enum accepts more, ` +\n `but config is opaque JSON and only these nine have renderer-verified configs — see the ` +\n `bigconsole.md recipe / reference-widgets/widget-configs.json before reaching for anything else.)`;\n\nexport const WidgetTypeEnum = z\n .enum(WIDGET_TYPES)\n .describe(\n `Widget renderer — one of the nine render-verified types: ${WIDGET_TYPE_LIST}. ` +\n 'The lowercase v2.0-internal keys (kanban, pivot_table, …) are rejected here.',\n );\n\n/**\n * Same nine-value gate for list-shaped inputs (`preferredWidgetTypes`).\n * Rejects every non-member individually with the full list in the message.\n */\nexport const WidgetTypeArray = z\n .array(z.string())\n .superRefine((values, ctx) => {\n for (const value of values) {\n if (!(WIDGET_TYPES as readonly string[]).includes(value)) {\n ctx.addIssue({ code: 'custom', message: WIDGET_TYPE_REJECTION(value) });\n }\n }\n })\n .transform((values) => values as (typeof WIDGET_TYPES)[number][]);\n\n// ── Other enums ─────────────────────────────────────────────────────────────\n\nexport const DashboardCategoryEnum = z\n .enum(['CUSTOM', 'EXECUTIVE', 'FINANCIAL', 'HR', 'MARKETING', 'OPERATIONS', 'SALES'])\n .describe('Dashboard category — pick the closest fit; CUSTOM when nothing fits');\n\nexport const DashboardVisibilityEnum = z\n .enum(['PRIVATE', 'WORKSPACE', 'PUBLIC'])\n .describe('Dashboard visibility (default PRIVATE)');\n\nexport const ParserTypeEnum = z\n .enum(['jq', 'jsonata', 'spark'])\n .describe('Parser transform engine — prefer jq');\n\nexport const ParserStatusEnum = z.enum(['active', 'inactive']).describe('Parser status');\n\nexport const DataSinkStatusEnum = z\n .enum(['ready', 'refreshing', 'stale', 'error'])\n .describe('Data sink status filter');\n\n// ── DataSink key ────────────────────────────────────────────────────────────\n\nconst DATA_SINK_KEY_PATTERN = /^[a-z0-9_]+$/;\n\nexport const DataSinkKey = z\n .string()\n .regex(\n DATA_SINK_KEY_PATTERN,\n 'Data sink keys are lowercase letters, numbers and underscores only — no hyphens ' +\n '(e.g. sales_2026).',\n )\n .describe('Unique slug within the workspace — lowercase letters, numbers, underscores only');\n\n// ── Widget config guard (the custom-widget hard limits) ─────────────────────\n\n/** Config keys the backend hard-rejects; encoding them client-side fails faster and clearer. */\nconst FORBIDDEN_CONFIG_KEYS = [\n 'html',\n 'iframeUrl',\n 'script',\n 'scriptUrl',\n 'render',\n 'srcDoc',\n 'onClick',\n] as const;\n\nconst FORBIDDEN_VALUE_PATTERN = /javascript:/i;\n\nfunction configViolation(key: string): string {\n return (\n `Widget config key \"${key}\" is not allowed — BigConsole widgets are built-in renderers + ` +\n 'declarative config, never custom code. No html, iframeUrl, script, scriptUrl, render, ' +\n 'srcDoc, onClick, or javascript: values.'\n );\n}\n\nexport const WidgetConfig = z\n .record(z.string(), z.unknown())\n .superRefine((config, ctx) => {\n for (const key of Object.keys(config)) {\n if ((FORBIDDEN_CONFIG_KEYS as readonly string[]).includes(key)) {\n ctx.addIssue({ code: 'custom', message: configViolation(key) });\n continue;\n }\n const value = config[key];\n if (typeof value === 'string' && FORBIDDEN_VALUE_PATTERN.test(value)) {\n ctx.addIssue({ code: 'custom', message: configViolation(`${key} (javascript: URL)`) });\n }\n }\n })\n .describe(\n 'Declarative renderer config (never empty). Charts need config.chartType ' +\n '(\"line\"|\"bar\"|\"area\"|\"pie\") matching the type; a single KPI needs ' +\n 'config._internalWidgetType \"metric_card\"; retention needs \"retention\". Field names must ' +\n 'match the parser/sink output keys.',\n );\n\n// ── Widget position on the 12-column grid ───────────────────────────────────\n\nexport const WidgetPosition = z\n .object({\n x: z.number().int().min(0).max(11).describe('Column start, 0–11'),\n y: z.number().int().min(0).describe('Row start'),\n width: z.number().int().min(1).max(12).describe('Width in columns, 1–12'),\n height: z.number().int().min(1).describe('Height in rows'),\n })\n .superRefine((position, ctx) => {\n if (position.x + position.width > 12) {\n ctx.addIssue({\n code: 'custom',\n message: `x + width must be ≤ 12 on the 12-column grid (got x=${position.x}, width=${position.width}).`,\n });\n }\n })\n .describe('Grid position on a 12-column grid: x 0–11, width 1–12, x+width ≤ 12, height ≥ 1');\n\n// ── Version (optimistic lock) ───────────────────────────────────────────────\n\nexport const VersionInt = z\n .number()\n .int()\n .describe(\n 'Current version for optimistic locking — read it from a get/list call first and send it ' +\n 'back unchanged; a stale version is rejected, so re-read and retry rather than guessing.',\n );\n\n/**\n * Rejection an update tool returns when `version` was omitted. Declared\n * optional in the zod schema so the HANDLER can produce this explicit\n * optimistic-lock message instead of the SDK's generic schema error — the\n * requirement is real either way: no update reaches the gateway without a\n * version.\n */\nexport const VERSION_OMITTED_MESSAGE =\n 'version is required for optimistic locking — read the current version from a get/list call ' +\n 'first and send it back unchanged. A stale version is rejected by the backend, so re-read and ' +\n 'retry rather than guessing or incrementing.';\n\n// ── Pagination ──────────────────────────────────────────────────────────────\n\nexport const PageSize = z\n .number()\n .int()\n .min(1)\n .max(100)\n .default(20)\n .describe('Page size (max 100)');\n\nexport const PageCursor = z\n .string()\n .optional()\n .describe('Pagination cursor from pageInfo.endCursor');\n","/**\n * BigConsole dashboard (console) tools, including the export/import round-trip.\n *\n * Surface (6): dashboards_list, dashboard_get, dashboard_create,\n * dashboard_page_create, dashboard_export, dashboard_import.\n *\n * ### \"Dashboards as code\" is the point of this module\n *\n * `dashboard_export` returns the Console Definition JSON — one declarative\n * document with the whole console (pages, widgets, layout, global filters).\n * `dashboard_import` reconstructs a console from that string. Round-trip them\n * and a coding agent can commit a console definition next to application code\n * and diff it in review; that workflow is the positioning no incumbent BI\n * vendor offers. Imported dashboards get REGENERATED ids — re-bind anything\n * that referenced the old dashboard by id.\n *\n * ### Lifecycle mutations are deliberately absent\n *\n * `archiveDashboard` / `restoreDashboard` / `publishDashboard` are not here:\n * archiving a production console is the destructive action v1 refuses to\n * expose to an external agent (AI_READINESS §2.2/§2.3). Read + create +\n * export/import is the valuable 90%.\n *\n * ### Selection sets stay slim (BOFF-2719 / BOFF-2720)\n *\n * Lists select scalar metadata only. `dashboard_get` pages through at most\n * 20 pages with per-page widget counts — it never expands widget configs,\n * which is what tripped the gateway cost limit in production.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport {\n jsonResult,\n textResult,\n errorResult,\n mcpToolName,\n type McpContext,\n} from '../../../core/index.js';\nimport {\n CREATE_DASHBOARD,\n CREATE_DASHBOARD_PAGE,\n EXPORT_DASHBOARD,\n GET_DASHBOARD,\n IMPORT_DASHBOARD,\n LIST_DASHBOARDS,\n VALIDATE_DASHBOARD_IMPORT,\n} from '../operations.js';\nimport {\n DashboardCategoryEnum,\n DashboardVisibilityEnum,\n PageCursor,\n PageSize,\n WORKSPACE_NOTE,\n} from './shared.js';\n\nexport function registerDashboardTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboards_list')),\n {\n title: 'List Dashboards',\n description:\n 'The dashboards (consoles) visible in the active workspace — metadata only, no widget ' +\n `configs. ${WORKSPACE_NOTE}`,\n inputSchema: {\n first: PageSize,\n after: PageCursor,\n search: z.string().optional().describe('Filter by name substring'),\n category: DashboardCategoryEnum.optional(),\n visibility: DashboardVisibilityEnum.optional(),\n includeArchived: z\n .boolean()\n .optional()\n .describe('Include archived dashboards (excluded by default)'),\n },\n },\n async ({ first, after, search, category, visibility, includeArchived }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n listDashboards: Record<string, unknown>;\n }>(LIST_DASHBOARDS, {\n first: first ?? 20,\n after: after ?? null,\n search: search ?? null,\n category: category ?? null,\n visibility: visibility ?? null,\n includeArchived: includeArchived ?? null,\n });\n return jsonResult(data.listDashboards);\n } catch (error) {\n ctx.logger.error('bigconsole dashboards_list failed', { error: String(error) });\n return errorResult(\n `Failed to list dashboards: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_get')),\n {\n title: 'Get Dashboard',\n description:\n 'One dashboard with its pages (ids — you need the page id to place widgets), global ' +\n 'filters, and page/widget counts. Widget configs are NOT expanded (gateway cost ' +\n 'limit). ' +\n WORKSPACE_NOTE,\n inputSchema: {\n id: z.string().describe('Dashboard ID'),\n },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n getDashboard: Record<string, unknown> | null;\n }>(GET_DASHBOARD, { id });\n if (!data.getDashboard) {\n return errorResult(`Dashboard \"${id}\" not found or not visible.`);\n }\n return jsonResult(data.getDashboard);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_get failed', { error: String(error) });\n return errorResult(\n `Failed to get the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_create')),\n {\n title: 'Create Dashboard',\n description:\n 'Create a console (dashboard). `createDefaultPage` defaults to true, so a first page is ' +\n 'created for you — read its id back via dashboard_get to place widgets. Step 2 of the ' +\n 'pipeline (DataSink → Dashboard → Parser → Widget). ' +\n WORKSPACE_NOTE,\n inputSchema: {\n name: z.string().describe('Dashboard name'),\n category: DashboardCategoryEnum,\n description: z.string().optional(),\n visibility: DashboardVisibilityEnum.optional(),\n createDefaultPage: z.boolean().optional().describe('Create a first page (default true)'),\n },\n },\n async ({ name, category, description, visibility, createDefaultPage }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n createBigConsoleDashboard: Record<string, unknown>;\n }>(CREATE_DASHBOARD, {\n input: {\n name,\n category,\n ...(description !== undefined ? { description } : {}),\n ...(visibility !== undefined ? { visibility } : {}),\n ...(createDefaultPage !== undefined ? { createDefaultPage } : {}),\n },\n });\n return jsonResult(result.createBigConsoleDashboard);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_page_create')),\n {\n title: 'Create Dashboard Page',\n description:\n 'Add a page to an existing dashboard. Only needed for multi-page consoles — a new ' +\n 'dashboard already has a default page. Widgets are placed on a page, not on the ' +\n 'dashboard. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n dashboardId: z.string().describe('Parent dashboard ID'),\n name: z.string().describe('Page name'),\n },\n },\n async ({ dashboardId, name }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n createDashboardPage: Record<string, unknown>;\n }>(CREATE_DASHBOARD_PAGE, { input: { dashboardId, name } });\n return jsonResult(result.createDashboardPage);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_page_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the page: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_export')),\n {\n title: 'Export Dashboard (Console Definition JSON)',\n description:\n 'Export a dashboard as the portable Console Definition JSON — one declarative document ' +\n 'with pages, widgets, layout and global filters. Commit it next to your code, diff it ' +\n 'in review, feed it to dashboard_import to reconstruct. This is a QUERY, not a mutation. ' +\n 'Leave includeWebhookMappings false unless you hold dashboard-edit permission AND a ' +\n 'current export consent grant. ' +\n WORKSPACE_NOTE,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n inputSchema: {\n id: z.string().describe('Dashboard ID to export'),\n prettyPrint: z.boolean().optional().describe('Pretty-print the JSON (default true)'),\n includeDataSourceRefs: z\n .boolean()\n .optional()\n .describe('Include data source references (default false)'),\n includeWebhookMappings: z\n .boolean()\n .optional()\n .describe(\n 'Include webhook mappings (default false; requires dashboard-edit permission and a ' +\n 'current export consent grant — never request casually)',\n ),\n },\n },\n async ({ id, prettyPrint, includeDataSourceRefs, includeWebhookMappings }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n exportDashboard: string;\n }>(EXPORT_DASHBOARD, {\n id,\n options: {\n prettyPrint: prettyPrint ?? true,\n includeDataSourceRefs: includeDataSourceRefs ?? false,\n includeWebhookMappings: includeWebhookMappings ?? false,\n },\n });\n return textResult(data.exportDashboard);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_export failed', { error: String(error) });\n return errorResult(\n `Failed to export the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_import')),\n {\n title: 'Import Dashboard (Console Definition JSON)',\n description:\n 'Reconstruct a dashboard from a Console Definition JSON string (from dashboard_export). ' +\n 'This is the cross-workspace move: export in one workspace, import the string in ' +\n 'another. Uses the v2.0 import path with per-entity stats — do NOT pair an export with ' +\n 'the legacy importDashboard mutation, which expects the deprecated v1 layout and ' +\n 'silently imports an empty dashboard. Imported ids are REGENERATED — re-bind anything ' +\n 'that referenced the old dashboard by id. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n content: z.string().describe('The Console Definition JSON string'),\n name: z.string().optional().describe('Override the dashboard name'),\n visibility: DashboardVisibilityEnum.optional(),\n skipWarnings: z\n .boolean()\n .optional()\n .describe('Import despite non-blocking validation warnings (default false)'),\n },\n },\n async ({ content, name, visibility, skipWarnings }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n importBigConsoleDashboard: {\n success: boolean;\n errorMessage?: string | null;\n dashboard?: Record<string, unknown> | null;\n stats?: Record<string, unknown> | null;\n };\n }>(IMPORT_DASHBOARD, {\n input: {\n content,\n ...(name !== undefined ? { name } : {}),\n ...(visibility !== undefined ? { visibility } : {}),\n ...(skipWarnings !== undefined ? { skipWarnings } : {}),\n },\n });\n if (!result.importBigConsoleDashboard.success) {\n // The v2 importer refuses to create when the definition carries\n // non-blocking warnings until the caller passes skipWarnings: true.\n // Fetch the validation detail so the agent can SEE the warnings and\n // make an informed acknowledge-or-fix decision.\n let detail = '';\n try {\n const validation = await ctx.gql.workspace.request<{\n validateDashboardImport: {\n errors: Array<{ code: string; message: string }>;\n warnings: Array<{ code: string; message: string; suggestion?: string | null }>;\n };\n }>(VALIDATE_DASHBOARD_IMPORT, { content });\n const lines: string[] = [];\n for (const e of validation.validateDashboardImport.errors ?? []) {\n lines.push(`error ${e.code}: ${e.message}`);\n }\n for (const w of validation.validateDashboardImport.warnings ?? []) {\n lines.push(\n `warning ${w.code}: ${w.message}${w.suggestion ? ` (${w.suggestion})` : ''}`,\n );\n }\n if (lines.length > 0) detail = ` Validation says: ${lines.join(' | ')}`;\n } catch {\n // validation fetch is best-effort; the raw errorMessage still stands\n }\n return errorResult(\n `Import failed: ${result.importBigConsoleDashboard.errorMessage ?? 'unknown error'}.${detail}`,\n 'Read the errors/warnings above; fix the definition, or re-call with skipWarnings: ' +\n 'true ONLY if every warning is understood and acceptable.',\n );\n }\n return jsonResult(result.importBigConsoleDashboard);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_import failed', { error: String(error) });\n return errorResult(\n `Failed to import the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * BigConsole data sink tools — the data layer of the console pipeline.\n *\n * Surface (4): datasinks_list, datasink_get, datasink_create, datasink_update.\n *\n * Read + create/update only — there is intentionally no `datasink_delete`:\n * sinks can feed live workflows and parsers, and an external agent retiring\n * one it does not fully understand is exactly the destructive action v1\n * omits (AI_READINESS §2.3).\n *\n * `datasink_get` never selects the `data` payload — sinks can hold arbitrary\n * bulk rows, and the MCP surface exists to author consoles, not to exfiltrate\n * data. Use `getDataSinkData` from the app when you actually need rows.\n *\n * `datasink_update` carries the optimistic-lock `version` INSIDE the input\n * (the backend's shape) and requires it as a tool input — see shared.ts.\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 CREATE_DATA_SINK,\n GET_DATA_SINK,\n LIST_DATA_SINKS,\n UPDATE_DATA_SINK,\n} from '../operations.js';\nimport {\n DataSinkKey,\n DataSinkStatusEnum,\n PageCursor,\n PageSize,\n VersionInt,\n VERSION_OMITTED_MESSAGE,\n WORKSPACE_NOTE,\n} from './shared.js';\n\nexport function registerDataSinkTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasinks_list')),\n {\n title: 'List Data Sinks',\n description:\n 'The data sinks of the active workspace with status and refresh metadata — metadata ' +\n `only, never payloads. ${WORKSPACE_NOTE}`,\n inputSchema: {\n first: PageSize,\n after: PageCursor,\n search: z.string().optional().describe('Filter by name or key substring'),\n status: DataSinkStatusEnum.optional(),\n },\n },\n async ({ first, after, search, status }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n listDataSinks: Record<string, unknown>;\n }>(LIST_DATA_SINKS, {\n first: first ?? 20,\n after: after ?? null,\n search: search ?? null,\n status: status ?? null,\n });\n return jsonResult(data.listDataSinks);\n } catch (error) {\n ctx.logger.error('bigconsole datasinks_list failed', { error: String(error) });\n return errorResult(\n `Failed to list data sinks: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasink_get')),\n {\n title: 'Get Data Sink',\n description:\n 'One data sink by id or key (exactly one of them) — metadata, linked-parser count and ' +\n 'version for optimistic-lock updates. Does NOT return the stored data payload. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n id: z.string().optional().describe('Data sink ID'),\n key: z.string().optional().describe('Data sink key (slug) — alternative to id'),\n },\n },\n async ({ id, key }) => {\n if (!id && !key) {\n return errorResult(\n 'Provide exactly one of id or key.',\n 'Pass the data sink id from datasinks_list, or its key (slug).',\n );\n }\n if (id && key) {\n return errorResult('Provide exactly one of id or key, not both.');\n }\n try {\n const data = await ctx.gql.workspace.request<{\n getDataSink: Record<string, unknown> | null;\n }>(GET_DATA_SINK, { id: id ?? null, key: key ?? null });\n if (!data.getDataSink) {\n return errorResult(`Data sink not found for ${id ? `id \"${id}\"` : `key \"${key}\"`}.`);\n }\n return jsonResult(data.getDataSink);\n } catch (error) {\n ctx.logger.error('bigconsole datasink_get failed', { error: String(error) });\n return errorResult(\n `Failed to get the data sink: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasink_create')),\n {\n title: 'Create Data Sink',\n description:\n 'Create a data sink — the first step of the console pipeline (DataSink → Dashboard → ' +\n 'Parser → Widget). `key` is the only required field; pass `data` as an array of row ' +\n 'objects for a snapshot, or leave it empty and feed the sink from a workflow later. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n key: DataSinkKey,\n name: z.string().optional().describe('Display name (defaults to the key)'),\n description: z.string().optional(),\n data: z\n .unknown()\n .optional()\n .describe('Initial payload — an array of row objects for a snapshot load'),\n ttl: z.number().int().min(0).optional().describe('Cache TTL in seconds (default 300)'),\n },\n },\n async ({ key, name, description, data, ttl }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n createDataSink: Record<string, unknown>;\n }>(CREATE_DATA_SINK, {\n input: {\n key,\n ...(name !== undefined ? { name } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(data !== undefined ? { data } : {}),\n ...(ttl !== undefined ? { ttl } : {}),\n },\n });\n return jsonResult(result.createDataSink);\n } catch (error) {\n ctx.logger.error('bigconsole datasink_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the data sink: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasink_update')),\n {\n title: 'Update Data Sink',\n description:\n 'Update a data sink with optimistic locking. `version` is REQUIRED — read the current ' +\n 'value from datasink_get first and send it back unchanged; a stale version is rejected, ' +\n 'so re-read and retry rather than incrementing blindly. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n id: z.string().describe('Data sink ID'),\n version: VersionInt.optional(),\n name: z.string().optional(),\n description: z.string().optional(),\n data: z.unknown().optional().describe('Replacement payload (array of row objects)'),\n ttl: z.number().int().min(0).optional(),\n isActive: z.boolean().optional(),\n },\n },\n async ({ id, version, name, description, data, ttl, isActive }) => {\n if (version === undefined) {\n return errorResult(VERSION_OMITTED_MESSAGE);\n }\n try {\n const result = await ctx.gql.workspace.request<{\n updateDataSink: Record<string, unknown>;\n }>(UPDATE_DATA_SINK, {\n input: {\n id,\n version,\n ...(name !== undefined ? { name } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(data !== undefined ? { data } : {}),\n ...(ttl !== undefined ? { ttl } : {}),\n ...(isActive !== undefined ? { isActive } : {}),\n },\n });\n return jsonResult(result.updateDataSink);\n } catch (error) {\n ctx.logger.error('bigconsole datasink_update failed', { error: String(error) });\n return errorResult(\n `Failed to update the data sink: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * BigConsole generate-from-prompt tool — the AI console lifecycle.\n *\n * Surface (1): dashboard_generate_from_prompt.\n *\n * Runs the whole lifecycle in one call: submit the generation, poll it to a\n * terminal status (PENDING → PROCESSING → GENERATING → COMPLETED | FAILED |\n * CANCELLED), then — only when `materialize` is explicitly true — turn the\n * completed spec into a real dashboard via createDashboardFromGeneration.\n *\n * ### Metering and defaults\n *\n * `generateDashboardFromPrompt` and `createDashboardFromGeneration` are\n * `@usage`-metered (they spend the workspace's AI credits). `materialize`\n * therefore defaults to FALSE: the default path spends exactly one\n * generation and hands the agent the spec digest to review, and turning it\n * into a dashboard is an explicit second decision. Pass the exact\n * `generatedSpecDigest` this tool returns back as `expectedSpecDigest` with\n * `materialize: true` so linked reuse refuses an obsolete revision instead of\n * silently materializing a changed spec.\n *\n * A generated console arrives bound to whatever the spec says — verify widget\n * bindings against the workspace's real data sinks (datasinks_list) before\n * trusting it as live.\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 CREATE_DASHBOARD_FROM_GENERATION,\n GENERATE_DASHBOARD_FROM_PROMPT,\n GET_PROMPT_GENERATION,\n} from '../operations.js';\nimport {\n DashboardCategoryEnum,\n DashboardVisibilityEnum,\n WidgetTypeArray,\n WORKSPACE_NOTE,\n} from './shared.js';\n\nconst TERMINAL_STATUSES = ['COMPLETED', 'FAILED', 'CANCELLED'] as const;\n\nconst TERMINAL_SET: ReadonlySet<string> = new Set(TERMINAL_STATUSES);\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport function registerGenerateTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_generate_from_prompt')),\n {\n title: 'Generate Dashboard From Prompt',\n description:\n 'Generate a whole console spec from natural language, poll it to completion, and ' +\n 'optionally materialize it into a real dashboard. Metered (spends AI credits): ' +\n 'generating always costs one generation; materialization only happens when ' +\n '`materialize: true`, and should pass the returned generatedSpecDigest back as ' +\n 'expectedSpecDigest so an obsolete spec revision is refused. After materializing, ' +\n \"verify widget bindings against the workspace's real data sinks. \" +\n WORKSPACE_NOTE,\n inputSchema: {\n prompt: z\n .string()\n .describe(\n 'Natural language description of the desired console, e.g. \"a sales dashboard with ' +\n 'revenue trends, top products and regional performance\"',\n ),\n maxWidgets: z\n .number()\n .int()\n .min(1)\n .max(24)\n .optional()\n .describe('Maximum widgets to generate (default 8)'),\n category: DashboardCategoryEnum.optional(),\n preferredWidgetTypes: z\n .array(z.string())\n .optional()\n .describe(\n 'Preferred widget types (from the nine render-verified types; any other value is ' +\n 'rejected with the full list)',\n ),\n additionalContext: z.string().optional(),\n visibility: DashboardVisibilityEnum.optional(),\n materialize: z\n .boolean()\n .optional()\n .describe(\n 'Materialize the completed spec into a real dashboard (default false; metered — ' +\n 'review the generatedSpecDigest first)',\n ),\n expectedSpecDigest: z\n .string()\n .optional()\n .describe(\n 'The exact generatedSpecDigest this tool returned, passed back so an obsolete spec ' +\n 'revision is refused (only used with materialize: true)',\n ),\n pollIntervalMs: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Poll interval while the generation runs (default 2000ms)'),\n pollTimeoutMs: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Give up polling after this long (default 120000ms)'),\n },\n },\n async ({\n prompt,\n maxWidgets,\n category,\n preferredWidgetTypes,\n additionalContext,\n visibility,\n materialize,\n expectedSpecDigest,\n pollIntervalMs,\n pollTimeoutMs,\n }) => {\n const parsedTypes = preferredWidgetTypes\n ? WidgetTypeArray.safeParse(preferredWidgetTypes)\n : null;\n if (parsedTypes && !parsedTypes.success) {\n return errorResult(\n parsedTypes.error.issues.map((issue) => issue.message).join(' '),\n 'Use only the nine render-verified widget types named in the message.',\n );\n }\n if (expectedSpecDigest && materialize !== true) {\n return errorResult(\n 'expectedSpecDigest is only meaningful with materialize: true.',\n 'Review the generatedSpecDigest from the result, then re-call with materialize: true ' +\n 'and the digest.',\n );\n }\n\n const interval = pollIntervalMs ?? 2000;\n const timeout = pollTimeoutMs ?? 120_000;\n\n let generation: {\n id: string;\n status: string;\n errorMessage?: string | null;\n generatedSpecDigest?: string | null;\n dashboardId?: string | null;\n } | null = null;\n\n try {\n const submitted = await ctx.gql.workspace.request<{\n generateDashboardFromPrompt: { id: string; status: string };\n }>(GENERATE_DASHBOARD_FROM_PROMPT, {\n input: {\n prompt,\n ...(maxWidgets !== undefined ? { maxWidgets } : {}),\n ...(category !== undefined ? { category } : {}),\n ...(parsedTypes?.data ? { preferredWidgetTypes: parsedTypes.data } : {}),\n ...(additionalContext !== undefined ? { additionalContext } : {}),\n ...(visibility !== undefined ? { visibility } : {}),\n },\n });\n\n const generationId = submitted.generateDashboardFromPrompt.id;\n const deadline = Date.now() + timeout;\n\n for (;;) {\n const polled = await ctx.gql.workspace.request<{\n getPromptGeneration: {\n id: string;\n status: string;\n errorMessage?: string | null;\n generatedSpecDigest?: string | null;\n dashboardId?: string | null;\n } | null;\n }>(GET_PROMPT_GENERATION, { id: generationId });\n\n generation = polled.getPromptGeneration ?? {\n id: generationId,\n status: 'MISSING',\n errorMessage: 'Generation record vanished while polling.',\n };\n\n if (TERMINAL_SET.has(generation.status) || Date.now() >= deadline) break;\n await sleep(interval);\n }\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_generate_from_prompt failed', {\n error: String(error),\n });\n return errorResult(\n `Failed to generate the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n if (!generation) {\n return errorResult('Generation did not return a record — try again.');\n }\n\n if (!TERMINAL_SET.has(generation.status)) {\n return jsonResult({\n generationId: generation.id,\n status: generation.status,\n note:\n 'Still running when the poll budget ran out — the generation continues server-side; ' +\n 're-check from the app or re-run with a larger pollTimeoutMs before materializing.',\n });\n }\n if (generation.status === 'FAILED' || generation.status === 'CANCELLED') {\n return errorResult(\n `Generation ${generation.status.toLowerCase()}${generation.errorMessage ? `: ${generation.errorMessage}` : '.'}`,\n 'Fix the prompt (or the workspace state) and submit a new generation — re-running a ' +\n 'failed one just spends another credit.',\n );\n }\n\n // COMPLETED\n const base = {\n generationId: generation.id,\n status: generation.status,\n generatedSpecDigest: generation.generatedSpecDigest ?? null,\n };\n\n if (materialize !== true) {\n return jsonResult({\n ...base,\n materialized: false,\n next:\n 'Review the generated spec, then re-call with materialize: true and pass ' +\n 'generatedSpecDigest as expectedSpecDigest to create the dashboard.',\n });\n }\n\n try {\n const created = await ctx.gql.workspace.request<{\n createDashboardFromGeneration: Record<string, unknown>;\n }>(CREATE_DASHBOARD_FROM_GENERATION, {\n input: {\n generationId: generation.id,\n ...(expectedSpecDigest !== undefined ? { expectedSpecDigest } : {}),\n },\n });\n return jsonResult({\n ...base,\n materialized: true,\n dashboard: created.createDashboardFromGeneration,\n });\n } catch (error) {\n ctx.logger.error('bigconsole dashboard materialization failed', { error: String(error) });\n return errorResult(\n `Generation completed but materialization failed: ${error instanceof Error ? error.message : String(error)}`,\n 'The spec is still there — re-call with materialize: true and the same ' +\n 'generatedSpecDigest as expectedSpecDigest.',\n );\n }\n },\n );\n}\n","/**\n * BigConsole parser tools — the shaping layer of the pipeline.\n *\n * Surface (4): parsers_list, parser_create, parser_update,\n * parser_test_expression.\n *\n * A parser transforms a data sink's rows into the shape a widget renders:\n * `jq` / `jsonata` / `spark` over the sink's payload, read by `inputSinkKey`\n * (the slug, NOT the id), written to `outputKey`, scoped to a console via\n * `consoleId` — which is the DASHBOARD id. Parsers are optional: if sink rows\n * are already chart-shaped, bind the widget straight to the sink.\n *\n * `parser_test_expression` runs the expression server-side against a stored\n * sink (by id or key) or inline sample rows, so an agent can iterate on the\n * expression before creating anything.\n *\n * `parser_update` takes the optimistic-lock `version` as a required top-level\n * tool input (the backend's shape differs from updateDataSink's in-input\n * version) — see shared.ts.\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 CREATE_PARSER,\n LIST_PARSERS,\n TEST_PARSER_EXPRESSION,\n UPDATE_PARSER,\n} from '../operations.js';\nimport {\n PageCursor,\n PageSize,\n ParserStatusEnum,\n ParserTypeEnum,\n VersionInt,\n VERSION_OMITTED_MESSAGE,\n WORKSPACE_NOTE,\n} from './shared.js';\n\nexport function registerParserTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parsers_list')),\n {\n title: 'List Parsers',\n description:\n 'The parsers of one console. `consoleId` is the DASHBOARD id (not the workspace id, ' +\n 'not a page id) — parsers belong to the whole console. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n consoleId: z.string().describe('Dashboard (console) ID'),\n first: PageSize,\n after: PageCursor,\n },\n },\n async ({ consoleId, first, after }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n listParsers: Record<string, unknown>;\n }>(LIST_PARSERS, { consoleId, first: first ?? 20, after: after ?? null });\n return jsonResult(data.listParsers);\n } catch (error) {\n ctx.logger.error('bigconsole parsers_list failed', { error: String(error) });\n return errorResult(\n `Failed to list parsers: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parser_create')),\n {\n title: 'Create Parser',\n description:\n 'Create a parser on a console. Step 3 of the pipeline (DataSink → Dashboard → Parser → ' +\n 'Widget). `consoleId` is the dashboard id; `inputSinkKey` is the data sink KEY (slug), ' +\n 'not its id; `outputKey` is a new slug the widget will read. Prefer type jq. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n consoleId: z.string().describe('Dashboard (console) ID'),\n name: z.string().describe('Parser name'),\n type: ParserTypeEnum,\n expression: z\n .string()\n .describe('Transform expression, e.g. jq: [.[] | {label: .grade, value: .present}]'),\n inputSinkKey: z\n .string()\n .describe('The data sink KEY (slug) the parser reads — not the sink id'),\n outputKey: z.string().describe('New slug for the parser output, e.g. sales_2026_chart'),\n description: z.string().optional(),\n ttl: z.number().int().min(0).optional(),\n },\n },\n async ({ consoleId, name, type, expression, inputSinkKey, outputKey, description, ttl }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n createParser: Record<string, unknown>;\n }>(CREATE_PARSER, {\n input: {\n consoleId,\n name,\n type,\n expression,\n inputSinkKey,\n outputKey,\n ...(description !== undefined ? { description } : {}),\n ...(ttl !== undefined ? { ttl } : {}),\n },\n });\n return jsonResult(result.createParser);\n } catch (error) {\n ctx.logger.error('bigconsole parser_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the parser: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parser_update')),\n {\n title: 'Update Parser',\n description:\n 'Update a parser with optimistic locking. `version` is REQUIRED and is a top-level ' +\n 'argument (unlike the data sink, where it lives inside the input) — read the current ' +\n 'value from parsers_list first and send it back unchanged; a stale version is rejected, ' +\n 'so re-read and retry rather than incrementing blindly. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n id: z.string().describe('Parser ID'),\n version: VersionInt.optional(),\n name: z.string().optional(),\n expression: z.string().optional(),\n inputSinkKey: z.string().optional(),\n outputKey: z.string().optional(),\n description: z.string().optional(),\n ttl: z.number().int().min(0).optional(),\n status: ParserStatusEnum.optional(),\n },\n },\n async ({\n id,\n version,\n name,\n expression,\n inputSinkKey,\n outputKey,\n description,\n ttl,\n status,\n }) => {\n if (version === undefined) {\n return errorResult(VERSION_OMITTED_MESSAGE);\n }\n try {\n const result = await ctx.gql.workspace.request<{\n updateParser: Record<string, unknown>;\n }>(UPDATE_PARSER, {\n id,\n version,\n input: {\n ...(name !== undefined ? { name } : {}),\n ...(expression !== undefined ? { expression } : {}),\n ...(inputSinkKey !== undefined ? { inputSinkKey } : {}),\n ...(outputKey !== undefined ? { outputKey } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(ttl !== undefined ? { ttl } : {}),\n ...(status !== undefined ? { status } : {}),\n },\n });\n return jsonResult(result.updateParser);\n } catch (error) {\n ctx.logger.error('bigconsole parser_update failed', { error: String(error) });\n return errorResult(\n `Failed to update the parser: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parser_test_expression')),\n {\n title: 'Test Parser Expression',\n description:\n 'Run a parser expression server-side WITHOUT creating anything — against a stored data ' +\n 'sink (by id or key, preferred: the payload never crosses the wire to you) or against ' +\n 'inline sample rows. Iterate on the expression here, then parser_create. ' +\n WORKSPACE_NOTE,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n inputSchema: {\n type: ParserTypeEnum,\n expression: z.string().describe('Transform expression to test'),\n dataSinkId: z\n .string()\n .optional()\n .describe('Stored data sink ID to test against (preferred)'),\n dataSinkKey: z\n .string()\n .optional()\n .describe('Stored data sink key (slug) — alternative to dataSinkId'),\n sampleData: z\n .unknown()\n .optional()\n .describe(\n 'Inline sample payload (array of row objects) — alternative to a sink reference',\n ),\n sampleLimit: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Cap rows evaluated when testing against a stored sink'),\n },\n },\n async ({ type, expression, dataSinkId, dataSinkKey, sampleData, sampleLimit }) => {\n const refs = [dataSinkId, dataSinkKey, sampleData].filter((v) => v !== undefined).length;\n if (refs === 0) {\n return errorResult(\n 'Provide exactly one test target: dataSinkId, dataSinkKey, or sampleData.',\n 'Prefer a data sink reference so the payload stays server-side; use sampleData only ' +\n 'for the hand-edited-JSON path.',\n );\n }\n if (refs > 1) {\n return errorResult(\n 'dataSinkId, dataSinkKey and sampleData are mutually exclusive — provide exactly one.',\n );\n }\n try {\n const data = await ctx.gql.workspace.request<{\n testParserExpression: Record<string, unknown>;\n }>(TEST_PARSER_EXPRESSION, {\n input: {\n type,\n expression,\n ...(dataSinkId !== undefined ? { dataSinkId } : {}),\n ...(dataSinkKey !== undefined ? { dataSinkKey } : {}),\n ...(sampleData !== undefined ? { sampleData } : {}),\n ...(sampleLimit !== undefined ? { sampleLimit } : {}),\n },\n });\n return jsonResult(data.testParserExpression);\n } catch (error) {\n ctx.logger.error('bigconsole parser_test_expression failed', { error: String(error) });\n return errorResult(\n `Failed to test the expression: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * BigConsole widget tool — the rendering layer of the pipeline.\n *\n * Surface (1): widget_create.\n *\n * A widget is a built-in renderer + a rich declarative `config` + a field\n * mapping, bound to a data sink and/or parser, placed on a PAGE (not the\n * dashboard — get the page id from dashboard_get). Step 4 of the pipeline.\n *\n * ### The config is the custom-widget builder\n *\n * There is no code path: `config` is opaque JSON the renderer reads, and the\n * two rules that make a widget render correctly are enforced by the zod\n * shapes in shared.ts, not by documentation:\n *\n * - charts store as one internal renderer — `config.chartType`\n * (\"line\"|\"bar\"|\"area\"|\"pie\") must match the enum type or the widget\n * renders as a line regardless of `type`;\n * - single-KPI cards need `config._internalWidgetType: \"metric_card\"` and\n * retention grids need `\"retention\"` — without them the wrong renderer\n * picks the widget up.\n *\n * Field names in the config must match the keys the parser/sink emits per\n * row: the renderer reads `row[config.valueField]`, `row[config.xAxisField]`,\n * `row[column.key]` — a mismatch renders an empty widget with no error.\n *\n * Only the nine render-verified types are accepted; see shared.ts for why.\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 { CREATE_WIDGET } from '../operations.js';\nimport { WidgetConfig, WidgetPosition, WidgetTypeEnum, WORKSPACE_NOTE } from './shared.js';\n\nexport function registerWidgetTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widget_create')),\n {\n title: 'Create Widget',\n description:\n 'Place a widget on a dashboard page — the last step of the pipeline (DataSink → ' +\n 'Dashboard → Parser → Widget). Bind data with parserId (preferred — the parser output ' +\n 'is already chart-shaped) and/or dataSinkId. Build a rich config for the chosen type ' +\n '(never {}): charts need config.chartType matching the type, single-KPI needs ' +\n 'config._internalWidgetType \"metric_card\", retention needs \"retention\"; field names ' +\n 'must match the parser/sink output keys. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n pageId: z\n .string()\n .describe('Page ID (from dashboard_get — widgets live on pages, not dashboards)'),\n title: z.string().describe('Widget title'),\n type: WidgetTypeEnum,\n config: WidgetConfig,\n position: WidgetPosition,\n parserId: z\n .string()\n .optional()\n .describe('Parser whose output the widget reads (preferred binding)'),\n dataSinkId: z\n .string()\n .optional()\n .describe('Data sink the widget reads (use alone when rows are already chart-shaped)'),\n },\n },\n async ({ pageId, title, type, config, position, parserId, dataSinkId }) => {\n if (!parserId && !dataSinkId) {\n return errorResult(\n 'Bind the widget to data: provide parserId and/or dataSinkId.',\n 'Widgets without a binding render empty. Prefer parserId so the data is already ' +\n 'shaped for the renderer.',\n );\n }\n try {\n const result = await ctx.gql.workspace.request<{\n createBigConsoleWidget: Record<string, unknown>;\n }>(CREATE_WIDGET, {\n input: {\n pageId,\n title,\n type,\n config,\n position,\n ...(parserId !== undefined ? { parserId } : {}),\n ...(dataSinkId !== undefined ? { dataSinkId } : {}),\n },\n });\n return jsonResult(result.createBigConsoleWidget);\n } catch (error) {\n ctx.logger.error('bigconsole widget_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the widget: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * BigConsole module — console authoring for external agents (BOFF-3729).\n *\n * Backend subgraph: ~/products/wspace/bigconsole/wspace-bigconsole-svc/\n * (Hive service name `bigconsole`). Runs against the WORKSPACE PUBLIC gateway,\n * which is where `@rbac` is enforced from the composed supergraph. This module\n * authorises nothing itself and never touches a token — `ctx.gql.workspace`\n * injects the session credential (app-client-credentials or device-code login)\n * and the `x-workspace-id` header chosen via `auth_select_workspace`.\n *\n * ### The least-privilege surface (AI_READINESS §2.2)\n *\n * Sixteen tools covering exactly the console-authoring pipeline and nothing\n * else:\n *\n * - DataSinks: list / get / create / update (4)\n * - Dashboards + pages: list / get / create / page-create (4)\n * - Parsers: list / create / update / test-expression (4)\n * - Widgets: create (1)\n * - Console Definition JSON: export / import (2) — the headline round-trip\n * - Generate-from-prompt: submit + poll + optional materialize (1)\n *\n * Deliberately absent: every `delete_*` / `archive_*` / `publish` /\n * share / RLS / embed / template-store mutation. Read + create (+ the two\n * sanctioned updates, both version-locked) is the valuable 90%, and an\n * external agent that cannot archive a production console is the security\n * posture the readiness audit asks for (§2.2/§2.3).\n *\n * ### The recipe is the contract\n *\n * Tool shapes mirror `ai-assistant/context/api-calls/products/bigconsole.md`\n * (the authoritative build recipe): the forced DataSink → Dashboard → Parser\n * → Widget order falls out of the argument shapes (`consoleId` = dashboard\n * id, widgets bound by pageId / parserId / dataSinkId), and the two footguns\n * are tool-level zod constraints in tools/shared.ts, not documentation.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerDashboardTools } from './tools/dashboards.js';\nimport { registerDataSinkTools } from './tools/datasinks.js';\nimport { registerGenerateTools } from './tools/generate.js';\nimport { registerParserTools } from './tools/parsers.js';\nimport { registerWidgetTools } from './tools/widgets.js';\n\nconst bigconsoleModule: McpModule = {\n id: 'bigconsole',\n version: '0.0.1',\n displayName: 'BigConsole',\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 registerDataSinkTools(server, ctx, track);\n registerDashboardTools(server, ctx, track);\n registerParserTools(server, ctx, track);\n registerWidgetTools(server, ctx, track);\n registerGenerateTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default bigconsoleModule;\n"]}
1
+ {"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/tool-name.ts","../../../src/core/result.ts","../../../src/modules/bigconsole/operations.ts","../../../src/modules/bigconsole/tools/shared.ts","../../../src/modules/bigconsole/tools/call.ts","../../../src/modules/bigconsole/tools/dashboards.ts","../../../src/modules/bigconsole/tools/datasinks.ts","../../../src/modules/bigconsole/tools/generate.ts","../../../src/modules/bigconsole/tools/linked-workflows.ts","../../../src/modules/bigconsole/tools/parsers.ts","../../../src/modules/bigconsole/tools/pipelines.ts","../../../src/modules/bigconsole/tools/prompts.ts","../../../src/modules/bigconsole/tools/widgets.ts","../../../src/modules/bigconsole/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;;;AC1BA,IAAM,oBAAA,GAAuB,EAAA;AAE7B,SAAS,cAAA,CAAe,MAAc,IAAA,EAA8C;AAClF,EAAA,IAAuB,IAAA,CAAK,MAAA,GAAS,oBAAA,EAAsB;AACzD,IAAA,MAAM,IAAI,gBAAA;AAAA,MACR,CAAA,WAAA,EAAc,IAAI,CAAA,UAAA,EAAa,oBAAoB,CAAA,8CAAA;AAAA,KACrD;AAAA,EACF;AACA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,WAAA,EAAa,YAAA;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,qBAAA,CAAsB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACxC,IAAA,sBAAA,CAAuB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACzC,IAAA,mBAAA,CAAoB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACtC,IAAA,mBAAA,CAAoB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACtC,IAAA,qBAAA,CAAsB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACxC,IAAA,qBAAA,CAAsB,MAAA,EAAQ,KAAK,KAAK,CAAA;AACxC,IAAA,2BAAA,CAA4B,MAAA,EAAQ,KAAK,KAAK,CAAA;AAC9C,IAAA,mBAAA,CAAoB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAEtC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,kBAAA,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 * 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\n/**\n * Name-based hint heuristics for MCP `annotations` (readOnlyHint /\n * destructiveHint). Used by tool-governance.ts to auto-fill annotations for\n * the fleet of product modules that call `server.registerTool` directly\n * (bypassing the `registerTool()` core helper) and so never set them\n * explicitly today (BOFF-3903). Deliberately conservative — matched against\n * whole `_`-delimited segments so e.g. `timeentries_delete` and\n * `pomodoro_delete_goal` match, but a hypothetical `undeletable_check`\n * would not.\n *\n * The destructive verb set covers more than `delete`: stopping, killing or\n * terminating a running process, revoking or rotating a credential/share,\n * resetting settings and removing/purging/uninstalling are all actions an\n * MCP client must not auto-run without the user's intent (VC/FG parity G57 —\n * e.g. `vibecontrols_sessions_kill`, `vibecontrols_tunnels_rotate_credentials`\n * were previously reported as non-destructive).\n *\n * A module can always override the inference by passing an explicit\n * `annotations` object to `registerTool()` / `server.registerTool()` — do\n * that for the rare verb match that is harmless (e.g. a typing indicator's\n * `typing_stop`).\n */\nexport const DESTRUCTIVE_NAME_VERBS = [\n 'delete',\n 'destroy',\n 'erase',\n 'kill',\n 'purge',\n 'remove',\n 'reset',\n 'revoke',\n 'rotate',\n 'stop',\n 'terminate',\n 'uninstall',\n 'wipe',\n] as const;\nconst DESTRUCTIVE_NAME_SEGMENT = new RegExp(\n `(?:^|_)(?:${DESTRUCTIVE_NAME_VERBS.join('|')})(?:_|$)`,\n 'i',\n);\nconst READ_ONLY_NAME_SEGMENT = /(?:^|_)(?:list|get|search|check|read|count|stats|by_date)(?:_|$)/i;\n\n/** True when a tool name looks destructive (irreversibly deletes data) by naming convention. */\nexport function inferDestructiveHint(toolName: string): boolean {\n return DESTRUCTIVE_NAME_SEGMENT.test(toolName);\n}\n\n/**\n * True when a tool name looks read-only by naming convention. Never true for\n * a name that also looks destructive (a tool can't be both).\n */\nexport function inferReadOnlyHint(toolName: string): boolean {\n return !inferDestructiveHint(toolName) && READ_ONLY_NAME_SEGMENT.test(toolName);\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';\nimport type { ToolAnnotations } from './tool-governance.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 * Explicit MCP annotations (readOnlyHint / destructiveHint / ...). Optional\n * — when omitted, `wrapServerWithToolGovernance` (applied centrally in\n * `createMcpServer`) infers them from the tool name. Set this to override\n * the inference for a tool whose name doesn't match the naming convention.\n */\n annotations?: ToolAnnotations;\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 ...(metadata.annotations ? { annotations: metadata.annotations } : {}),\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 } } | 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 * Centralized GraphQL operations for the BigConsole MCP module (BOFF-3729).\n *\n * Backend subgraph: ~/products/wspace/bigconsole/wspace-bigconsole-svc/\n * (Hive service name `bigconsole`). Every operation here runs against the\n * WORKSPACE PUBLIC gateway, which is the only place `@rbac` is enforced from\n * the composed supergraph. This module authorises nothing itself and never\n * sees a token — `ctx.gql.workspace` injects the session's auth headers\n * (app-client-credentials or device-code login) plus the `x-workspace-id`\n * header set by `auth_select_workspace`.\n *\n * ### Selection sets are deliberately slim (BOFF-2719 / BOFF-2720)\n *\n * The gateway enforces a query-cost limit (`ARMOR_VIOLATION`) that fat\n * selection sets on `listDashboards` / `getDashboard` / `createDashboard`-\n * adjacent reads have tripped in production. So:\n *\n * - list queries select ids/keys/names and scalar metadata only — never\n * nested widget `config`, never `data` payloads;\n * - a widget's full `config` is only ever fetched for a single widget being\n * edited, and v1 ships no widget-config read at all;\n * - `getDataSink` never selects `data` (the payload can be arbitrarily large).\n *\n * Every operation name, argument and selected field below was verified\n * against the subgraph's `.hive-schema.graphql` — not assumed from naming.\n *\n * Uses template-string interpolation (not gql tagged fragments) to match the\n * canonical healthybowl / kadaikodi module operations files.\n */\n\n// ---------------------------------------------------------------------------\n// DataSinks\n// ---------------------------------------------------------------------------\n\nexport const LIST_DATA_SINKS = `\n query BigConsoleMcpListDataSinks($first: Int, $after: String, $search: String, $status: DataSinkStatus) {\n listDataSinks(first: $first, after: $after, search: $search, status: $status) {\n edges {\n node {\n id\n key\n name\n description\n status\n isActive\n setupState\n ttl\n version\n lastRefreshedAt\n updatedAt\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\nexport const GET_DATA_SINK = `\n query BigConsoleMcpGetDataSink($id: ID, $key: String) {\n getDataSink(id: $id, key: $key) {\n id\n key\n name\n description\n status\n isActive\n setupState\n dataClassification\n fieldMaskingEnabled\n ttl\n version\n linkedParserCount\n createdAt\n updatedAt\n lastRefreshedAt\n }\n }\n`;\n\nexport const CREATE_DATA_SINK = `\n mutation BigConsoleMcpCreateDataSink($input: CreateDataSinkInput!) {\n createDataSink(input: $input) {\n id\n key\n name\n status\n version\n }\n }\n`;\n\nexport const UPDATE_DATA_SINK = `\n mutation BigConsoleMcpUpdateDataSink($input: UpdateDataSinkInput!) {\n updateDataSink(input: $input) {\n id\n key\n name\n version\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Dashboards (consoles) + pages\n// ---------------------------------------------------------------------------\n\nexport const LIST_DASHBOARDS = `\n query BigConsoleMcpListDashboards(\n $first: Int\n $after: String\n $search: String\n $category: BigConsoleDashboardCategory\n $visibility: BigConsoleDashboardVisibility\n $includeArchived: Boolean\n ) {\n listDashboards(\n first: $first\n after: $after\n search: $search\n category: $category\n visibility: $visibility\n includeArchived: $includeArchived\n ) {\n edges {\n node {\n id\n name\n description\n category\n visibility\n status\n isArchived\n pageCount\n widgetCount\n updatedAt\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\nexport const GET_DASHBOARD = `\n query BigConsoleMcpGetDashboard($id: ID!) {\n getDashboard(id: $id) {\n id\n name\n description\n category\n visibility\n status\n isArchived\n pageCount\n widgetCount\n publishedAt\n globalFilters {\n id\n name\n type\n dependsOn\n }\n pages(first: 20) {\n edges {\n node {\n id\n name\n order\n widgetCount\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n }\n }\n }\n }\n`;\n\nexport const CREATE_DASHBOARD = `\n mutation BigConsoleMcpCreateDashboard($input: BigConsoleCreateDashboardInput!) {\n createBigConsoleDashboard(input: $input) {\n id\n name\n category\n visibility\n status\n pageCount\n }\n }\n`;\n\nexport const CREATE_DASHBOARD_PAGE = `\n mutation BigConsoleMcpCreateDashboardPage($input: BigConsoleCreateDashboardPageInput!) {\n createDashboardPage(input: $input) {\n id\n name\n dashboardId\n order\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Parsers\n// ---------------------------------------------------------------------------\n\nexport const LIST_PARSERS = `\n query BigConsoleMcpListParsers($consoleId: ID!, $first: Int, $after: String) {\n listParsers(filter: { consoleId: $consoleId }, first: $first, after: $after) {\n edges {\n node {\n id\n name\n type\n status\n inputSinkKey\n outputKey\n version\n updatedAt\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\nexport const CREATE_PARSER = `\n mutation BigConsoleMcpCreateParser($input: CreateParserInput!) {\n createParser(input: $input) {\n id\n name\n type\n status\n inputSinkKey\n outputKey\n version\n }\n }\n`;\n\nexport const UPDATE_PARSER = `\n mutation BigConsoleMcpUpdateParser($id: ID!, $input: UpdateParserInput!, $version: Int!) {\n updateParser(id: $id, input: $input, version: $version) {\n id\n name\n type\n status\n inputSinkKey\n outputKey\n version\n }\n }\n`;\n\nexport const TEST_PARSER_EXPRESSION = `\n query BigConsoleMcpTestParserExpression($input: TestParserInput!) {\n testParserExpression(input: $input) {\n success\n output\n error\n executionTimeMs\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Widgets\n// ---------------------------------------------------------------------------\n\nexport const CREATE_WIDGET = `\n mutation BigConsoleMcpCreateWidget($input: BigConsoleCreateWidgetInput!) {\n createBigConsoleWidget(input: $input) {\n id\n title\n type\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Export / import — the Console Definition JSON round-trip\n// ---------------------------------------------------------------------------\n\nexport const EXPORT_DASHBOARD = `\n query BigConsoleMcpExportDashboard($id: ID!, $options: BigConsoleExportDashboardOptions) {\n exportDashboard(id: $id, options: $options)\n }\n`;\n\n/**\n * Import is the v2.0 path (`importBigConsoleDashboard`), NOT the legacy\n * `importDashboard` mutation: the export QUERY emits schemaVersion \"1.0\"\n * with `pages` at the TOP level of the document, while the legacy v1\n * mutation reads `dashboard.pages` (the deprecated v1 export-mutation\n * layout) and silently imports an EMPTY dashboard from a v2 export. The v2\n * mutation is the verified round-trip partner of `exportDashboard` and\n * reports per-entity stats (pages/widgets/actions/filters created).\n */\nexport const IMPORT_DASHBOARD = `\n mutation BigConsoleMcpImportDashboard($input: ImportBigConsoleDashboardInput!) {\n importBigConsoleDashboard(input: $input) {\n success\n errorMessage\n dashboard {\n id\n name\n pageCount\n widgetCount\n }\n stats {\n pagesCreated\n widgetsCreated\n actionsCreated\n filtersCreated\n dataSourcesSkipped\n }\n }\n }\n`;\n\n/**\n * Validate an import WITHOUT creating anything. importBigConsoleDashboard\n * refuses (success: false) when the definition carries non-blocking warnings\n * until the caller passes skipWarnings: true — the agent needs the warning\n * text to make that call, and this query is how it reads them.\n */\nexport const VALIDATE_DASHBOARD_IMPORT = `\n query BigConsoleMcpValidateDashboardImport($content: String!) {\n validateDashboardImport(content: $content) {\n isValid\n dashboardInfo {\n name\n pageCount\n widgetCount\n schemaVersion\n }\n errors {\n code\n message\n path\n }\n warnings {\n code\n message\n suggestion\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Generate-from-prompt lifecycle\n// ---------------------------------------------------------------------------\n\nexport const GENERATE_DASHBOARD_FROM_PROMPT = `\n mutation BigConsoleMcpGenerateDashboardFromPrompt($input: BigConsoleGenerateDashboardFromPromptInput!) {\n generateDashboardFromPrompt(input: $input) {\n id\n status\n }\n }\n`;\n\nexport const GET_PROMPT_GENERATION = `\n query BigConsoleMcpGetPromptGeneration($id: ID!) {\n getPromptGeneration(id: $id) {\n id\n status\n errorMessage\n generatedSpecDigest\n dashboardId\n }\n }\n`;\n\nexport const CREATE_DASHBOARD_FROM_GENERATION = `\n mutation BigConsoleMcpCreateDashboardFromGeneration($input: BigConsoleCreateDashboardFromGenerationInput!) {\n createDashboardFromGeneration(input: $input) {\n id\n name\n pageCount\n widgetCount\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Second tranche (BOFF-11426): everything the SDK offers that is not a delete,\n// archive, restore, publish or share. Copied from bigconsole-sdk-node and checked\n// against the same pinned schema. Selections stay as slim as the first tranche:\n// lists never select widget `config`, and a single widget's `config` is read only\n// by GET_WIDGET, the one read an update needs. No document selects sink rows or parser output.\n// ---------------------------------------------------------------------------\n\nexport const UPDATE_DASHBOARD = `\n mutation BigConsoleMcpUpdateDashboard($input: BigConsoleUpdateDashboardInput!) {\n updateBigConsoleDashboard(input: $input) {\n id\n name\n description\n category\n visibility\n status\n version\n updatedAt\n }\n }\n`;\n\nexport const CLONE_DASHBOARD = `\n mutation BigConsoleMcpCloneDashboard($input: BigConsoleCloneDashboardInput!) {\n cloneDashboard(input: $input) {\n id\n name\n description\n category\n createdAt\n }\n }\n`;\n\nexport const SEARCH_DASHBOARDS = `\n query BigConsoleMcpSearchDashboards(\n $query: String!\n $category: BigConsoleDashboardCategory\n $visibility: BigConsoleDashboardVisibility\n $first: Int\n $after: String\n ) {\n searchDashboards(\n query: $query\n category: $category\n visibility: $visibility\n first: $first\n after: $after\n ) {\n id\n name\n description\n category\n visibility\n status\n createdAt\n }\n }\n`;\n\n// Widgets\n\nexport const GET_WIDGET = `\n query BigConsoleMcpGetWidget($id: ID!) {\n getWidget(id: $id) {\n id\n pageId\n dashboardId\n type\n title\n renderer\n config\n position\n dataSinkId\n parserId\n refreshInterval\n lastRefreshedAt\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const LIST_WIDGETS_BY_DASHBOARD = `\n query BigConsoleMcpListWidgetsByDashboard($dashboardId: ID!, $type: BigConsoleWidgetType) {\n listWidgetsByDashboard(dashboardId: $dashboardId, type: $type) {\n id\n pageId\n type\n title\n renderer\n position\n dataSinkId\n parserId\n updatedAt\n }\n }\n`;\n\nexport const UPDATE_WIDGET = `\n mutation BigConsoleMcpUpdateWidget($input: BigConsoleUpdateWidgetInput!) {\n updateBigConsoleWidget(input: $input) {\n id\n type\n title\n position\n updatedAt\n }\n }\n`;\n\nexport const DUPLICATE_WIDGET = `\n mutation BigConsoleMcpDuplicateWidget(\n $id: ID!\n $newPosition: BigConsoleWidgetPositionInput\n $newTitle: String\n ) {\n duplicateWidget(id: $id, newPosition: $newPosition, newTitle: $newTitle) {\n id\n pageId\n type\n title\n position\n createdAt\n }\n }\n`;\n\nexport const REFRESH_WIDGET_DATA = `\n mutation BigConsoleMcpRefreshWidgetData($widgetId: ID!) {\n refreshWidgetData(widgetId: $widgetId) {\n fetchedAt\n }\n }\n`;\n\nexport const GET_WIDGET_TYPES = `\n query BigConsoleMcpGetWidgetTypes {\n getWidgetTypes {\n type\n label\n category\n description\n defaultConfig\n defaultSize {\n width\n height\n }\n }\n }\n`;\n\nexport const GET_WIDGET_RENDERERS = `\n query BigConsoleMcpGetWidgetRenderers {\n getAvailableRenderers {\n type\n name\n description\n supportedWidgetTypes\n }\n }\n`;\n\n// Data sinks\n\nexport const REFRESH_DATA_SINK = `\n mutation BigConsoleMcpRefreshDataSink($input: RefreshDataSinkInput!) {\n refreshDataSink(input: $input) {\n id\n key\n name\n status\n lastRefreshedAt\n }\n }\n`;\n\nexport const INVALIDATE_DATA_SINK_CACHE = `\n mutation BigConsoleMcpInvalidateDataSinkCache($id: ID) {\n invalidateDataSinkCache(id: $id) {\n success\n count\n invalidatedIds\n message\n }\n }\n`;\n\n// Parsers\n\nexport const GET_PARSER = `\n query BigConsoleMcpGetParser($id: ID!) {\n parser(id: $id) {\n id\n consoleId\n name\n description\n type\n expression\n inputSinkKey\n outputKey\n outputWidgetId\n ttl\n status\n version\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const EXECUTE_PARSER = `\n mutation BigConsoleMcpExecuteParser($id: ID!) {\n executeParser(id: $id) {\n success\n error\n executionTimeMs\n }\n }\n`;\n\n// Pipelines\n\nexport const GET_PIPELINE = `\n query BigConsoleMcpGetPipeline($id: ID!) {\n pipeline(id: $id) {\n id\n consoleId\n name\n description\n status\n stages {\n id\n position\n parserId\n parserName\n parserType\n expression\n inputKey\n outputKey\n enabled\n onError\n fallbackValue\n description\n }\n lastExecutedAt\n version\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const LIST_PIPELINES = `\n query BigConsoleMcpListPipelines($filter: PipelineFilterInput, $first: Int, $after: String) {\n listPipelines(filter: $filter, first: $first, after: $after) {\n edges {\n node {\n id\n consoleId\n name\n description\n status\n lastExecutedAt\n version\n updatedAt\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\nexport const CREATE_PIPELINE = `\n mutation BigConsoleMcpCreatePipeline($input: CreatePipelineInput!) {\n createPipeline(input: $input) {\n id\n consoleId\n name\n status\n version\n }\n }\n`;\n\nexport const UPDATE_PIPELINE = `\n mutation BigConsoleMcpUpdatePipeline($id: ID!, $input: UpdatePipelineInput!, $version: Int!) {\n updatePipeline(id: $id, input: $input, version: $version) {\n id\n name\n status\n version\n updatedAt\n }\n }\n`;\n\nexport const EXECUTE_PIPELINE = `\n mutation BigConsoleMcpExecutePipeline($input: ExecutePipelineInput!) {\n executePipeline(input: $input) {\n id\n pipelineId\n status\n startedAt\n }\n }\n`;\n\nexport const TEST_PIPELINE = `\n mutation BigConsoleMcpTestPipeline($input: TestPipelineInput!) {\n testPipeline(input: $input) {\n id\n pipelineId\n status\n startedAt\n completedAt\n totalExecutionTimeMs\n error\n }\n }\n`;\n\nexport const LIST_PIPELINE_EXECUTIONS = `\n query BigConsoleMcpListPipelineExecutions($pipelineId: ID!, $first: Int, $after: String) {\n listPipelineExecutions(pipelineId: $pipelineId, first: $first, after: $after) {\n id\n pipelineVersion\n status\n startedAt\n completedAt\n totalExecutionTimeMs\n error\n }\n }\n`;\n\n// BigConsole workflows (the `workflow` and `workflows` root fields; not the FluidGrids definitions)\n\nexport const GET_LINKED_WORKFLOW = `\n query BigConsoleMcpGetLinkedWorkflow($id: ID!) {\n workflow(id: $id) {\n id\n name\n key\n description\n externalWorkflowId\n status\n lastExecutedAt\n lastExecutionId\n executionCount\n linkedDataSinkCount\n version\n createdAt\n updatedAt\n }\n }\n`;\n\nexport const LIST_LINKED_WORKFLOWS = `\n query BigConsoleMcpListLinkedWorkflows($filter: FluidGridsWorkflowFilterInput) {\n workflows(filter: $filter) {\n id\n name\n key\n description\n status\n lastExecutedAt\n executionCount\n linkedDataSinkCount\n version\n updatedAt\n }\n }\n`;\n\nexport const GET_LINKED_WORKFLOW_BY_KEY = `\n query BigConsoleMcpGetLinkedWorkflowByKey($key: String!) {\n workflowByKey(key: $key) {\n id\n name\n key\n description\n externalWorkflowId\n status\n lastExecutedAt\n executionCount\n linkedDataSinkCount\n version\n updatedAt\n }\n }\n`;\n\nexport const LIST_LINKED_WORKFLOW_DATA_SINK_LINKS = `\n query BigConsoleMcpListLinkedWorkflowDataSinkLinks($workflowId: ID!) {\n workflowDataSinkLinks(workflowId: $workflowId) {\n id\n dataSinkId\n workflowId\n isEnabled\n priority\n dataMapping\n updatedAt\n }\n }\n`;\n\nexport const CREATE_LINKED_WORKFLOW = `\n mutation BigConsoleMcpCreateLinkedWorkflow($input: CreateWorkflowInput!) {\n createWorkflow(input: $input) {\n id\n name\n key\n status\n version\n }\n }\n`;\n\nexport const UPDATE_LINKED_WORKFLOW = `\n mutation BigConsoleMcpUpdateLinkedWorkflow($id: ID!, $input: UpdateWorkflowInput!, $version: Int!) {\n updateWorkflow(id: $id, input: $input, version: $version) {\n id\n name\n status\n version\n updatedAt\n }\n }\n`;\n\nexport const EXECUTE_LINKED_WORKFLOW = `\n mutation BigConsoleMcpExecuteLinkedWorkflow($id: ID!, $triggerData: JSON) {\n executeWorkflow(id: $id, triggerData: $triggerData) {\n id\n name\n status\n lastExecutedAt\n lastExecutionId\n }\n }\n`;\n\n// Prompt generations\n\nexport const LIST_PROMPT_GENERATIONS = `\n query BigConsoleMcpListPromptGenerations($status: PromptGenerationStatus, $first: Int, $after: String) {\n listPromptGenerations(status: $status, first: $first, after: $after) {\n edges {\n node {\n id\n prompt\n status\n dashboardId\n errorMessage\n createdAt\n completedAt\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`;\n\nexport const CANCEL_PROMPT_GENERATION = `\n mutation BigConsoleMcpCancelPromptGeneration($generationId: ID!) {\n cancelPromptGeneration(generationId: $generationId) {\n id\n status\n }\n }\n`;\n\nexport const GET_PROMPT_SUGGESTIONS = `\n query BigConsoleMcpGetPromptSuggestions($category: String, $search: String, $limit: Int) {\n getPromptSuggestions(category: $category, search: $search, limit: $limit) {\n id\n title\n prompt\n category\n exampleDescription\n tags\n }\n }\n`;\n\nexport const PREVIEW_PROMPT_ANALYSIS = `\n query BigConsoleMcpPreviewPromptAnalysis($prompt: String!) {\n previewPromptAnalysis(prompt: $prompt) {\n detectedIntent\n detectedMetrics\n dataRequirements\n suggestedCategory\n suggestedWidgetTypes\n suggestedRefinements\n estimatedWidgetCount\n confidence\n }\n }\n`;\n","/**\n * Shared zod shapes + guardrails for the BigConsole tool surface.\n *\n * ### No tool here takes a workspace or a token\n *\n * `@rbac(scopeType: \"wspace\")` authorises the workspace named in the\n * `x-workspace-id` gateway header — the one `auth_select_workspace` sets — and\n * nothing else. BigConsole's inputs carry no workspace field at all, so there\n * is nothing to expose. Likewise no tool takes a token: the session's\n * credential (app-client-credentials or device-code login) is injected by\n * `ctx.gql.workspace` from the auth store, and a tool-level token input would\n * be a forwarded-user-token hole (AI_READINESS §2.1).\n *\n * ### The two footguns are encoded here, not in documentation\n *\n * 1. **The nine render-verified widget types.** Since BOFF-3550 every native\n * `BigConsoleWidgetType` member passes the gateway enum, but `config` is\n * opaque JSON and the renderer is the only judge — the v2.0-internal\n * lowercase keys (`kanban`, `pivot_table`, …) and the native types without\n * documented configs render wrong or not at all. The allowlist below is\n * the nine render-verified members; anything else is rejected client-side\n * with a message that names all nine.\n * 2. **Optimistic locking.** `updateDataSink` carries `version` inside the\n * input; `updateParser` takes it as a top-level argument. Both are\n * required `Int` tool inputs — a caller must read the current version\n * first (every read selects it) and send it back unchanged.\n *\n * @module bigconsole\n */\n\nimport { z } from 'zod';\n\n/** Appended to every tool description so the failure mode is stated where it will be read. */\nexport const WORKSPACE_NOTE =\n 'Operates on the workspace selected via auth_select_workspace — this tool takes no workspace ' +\n 'or token argument. Authorization is enforced at the gateway from the authenticated session.';\n\n// ── The nine render-verified widget types ───────────────────────────────────\n\nexport const WIDGET_TYPES = [\n 'LINE_CHART',\n 'BAR_CHART',\n 'AREA_CHART',\n 'PIE_CHART',\n 'TABLE',\n 'KPI',\n 'HEATMAP',\n 'FUNNEL',\n 'RETENTION',\n] as const;\n\nexport const WIDGET_TYPE_LIST = WIDGET_TYPES.join(', ');\n\nconst WIDGET_TYPE_REJECTION = (value: string): string =>\n `\"${value}\" is not a render-verified BigConsole widget type. This tool accepts exactly the nine ` +\n `render-verified types: ${WIDGET_TYPE_LIST}. (Since BOFF-3550 the gateway enum accepts more, ` +\n `but config is opaque JSON and only these nine have renderer-verified configs — see the ` +\n `bigconsole.md recipe / reference-widgets/widget-configs.json before reaching for anything else.)`;\n\nexport const WidgetTypeEnum = z\n .enum(WIDGET_TYPES)\n .describe(\n `Widget renderer — one of the nine render-verified types: ${WIDGET_TYPE_LIST}. ` +\n 'The lowercase v2.0-internal keys (kanban, pivot_table, …) are rejected here.',\n );\n\n/**\n * Same nine-value gate for list-shaped inputs (`preferredWidgetTypes`).\n * Rejects every non-member individually with the full list in the message.\n */\nexport const WidgetTypeArray = z\n .array(z.string())\n .superRefine((values, ctx) => {\n for (const value of values) {\n if (!(WIDGET_TYPES as readonly string[]).includes(value)) {\n ctx.addIssue({ code: 'custom', message: WIDGET_TYPE_REJECTION(value) });\n }\n }\n })\n .transform((values) => values as (typeof WIDGET_TYPES)[number][]);\n\n// ── Other enums ─────────────────────────────────────────────────────────────\n\nexport const DashboardCategoryEnum = z\n .enum(['CUSTOM', 'EXECUTIVE', 'FINANCIAL', 'HR', 'MARKETING', 'OPERATIONS', 'SALES'])\n .describe('Dashboard category — pick the closest fit; CUSTOM when nothing fits');\n\nexport const DashboardVisibilityEnum = z\n .enum(['PRIVATE', 'WORKSPACE', 'PUBLIC'])\n .describe('Dashboard visibility (default PRIVATE)');\n\nexport const ParserTypeEnum = z\n .enum(['jq', 'jsonata', 'spark'])\n .describe('Parser transform engine — prefer jq');\n\nexport const ParserStatusEnum = z.enum(['active', 'inactive']).describe('Parser status');\n\nexport const DataSinkStatusEnum = z\n .enum(['ready', 'refreshing', 'stale', 'error'])\n .describe('Data sink status filter');\n\n// ── DataSink key ────────────────────────────────────────────────────────────\n\nconst DATA_SINK_KEY_PATTERN = /^[a-z0-9_]+$/;\n\nexport const DataSinkKey = z\n .string()\n .regex(\n DATA_SINK_KEY_PATTERN,\n 'Data sink keys are lowercase letters, numbers and underscores only — no hyphens ' +\n '(e.g. sales_2026).',\n )\n .describe('Unique slug within the workspace — lowercase letters, numbers, underscores only');\n\n// ── Widget config guard (the custom-widget hard limits) ─────────────────────\n\n/** Config keys the backend hard-rejects; encoding them client-side fails faster and clearer. */\nconst FORBIDDEN_CONFIG_KEYS = [\n 'html',\n 'iframeUrl',\n 'script',\n 'scriptUrl',\n 'render',\n 'srcDoc',\n 'onClick',\n] as const;\n\nconst FORBIDDEN_VALUE_PATTERN = /javascript:/i;\n\nfunction configViolation(key: string): string {\n return (\n `Widget config key \"${key}\" is not allowed — BigConsole widgets are built-in renderers + ` +\n 'declarative config, never custom code. No html, iframeUrl, script, scriptUrl, render, ' +\n 'srcDoc, onClick, or javascript: values.'\n );\n}\n\nexport const WidgetConfig = z\n .record(z.string(), z.unknown())\n .superRefine((config, ctx) => {\n for (const key of Object.keys(config)) {\n if ((FORBIDDEN_CONFIG_KEYS as readonly string[]).includes(key)) {\n ctx.addIssue({ code: 'custom', message: configViolation(key) });\n continue;\n }\n const value = config[key];\n if (typeof value === 'string' && FORBIDDEN_VALUE_PATTERN.test(value)) {\n ctx.addIssue({ code: 'custom', message: configViolation(`${key} (javascript: URL)`) });\n }\n }\n })\n .describe(\n 'Declarative renderer config (never empty). Charts need config.chartType ' +\n '(\"line\"|\"bar\"|\"area\"|\"pie\") matching the type; a single KPI needs ' +\n 'config._internalWidgetType \"metric_card\"; retention needs \"retention\". Field names must ' +\n 'match the parser/sink output keys.',\n );\n\n// ── Widget position on the 12-column grid ───────────────────────────────────\n\nexport const WidgetPosition = z\n .object({\n x: z.number().int().min(0).max(11).describe('Column start, 0–11'),\n y: z.number().int().min(0).describe('Row start'),\n width: z.number().int().min(1).max(12).describe('Width in columns, 1–12'),\n height: z.number().int().min(1).describe('Height in rows'),\n })\n .superRefine((position, ctx) => {\n if (position.x + position.width > 12) {\n ctx.addIssue({\n code: 'custom',\n message: `x + width must be ≤ 12 on the 12-column grid (got x=${position.x}, width=${position.width}).`,\n });\n }\n })\n .describe('Grid position on a 12-column grid: x 0–11, width 1–12, x+width ≤ 12, height ≥ 1');\n\n// ── Version (optimistic lock) ───────────────────────────────────────────────\n\nexport const VersionInt = z\n .number()\n .int()\n .describe(\n 'Current version for optimistic locking — read it from a get/list call first and send it ' +\n 'back unchanged; a stale version is rejected, so re-read and retry rather than guessing.',\n );\n\n/**\n * Rejection an update tool returns when `version` was omitted. Declared\n * optional in the zod schema so the HANDLER can produce this explicit\n * optimistic-lock message instead of the SDK's generic schema error — the\n * requirement is real either way: no update reaches the gateway without a\n * version.\n */\nexport const VERSION_OMITTED_MESSAGE =\n 'version is required for optimistic locking — read the current version from a get/list call ' +\n 'first and send it back unchanged. A stale version is rejected by the backend, so re-read and ' +\n 'retry rather than guessing or incrementing.';\n\n// ── Pagination ──────────────────────────────────────────────────────────────\n\nexport const PageSize = z\n .number()\n .int()\n .min(1)\n .max(100)\n .default(20)\n .describe('Page size (max 100)');\n\nexport const PageCursor = z\n .string()\n .optional()\n .describe('Pagination cursor from pageInfo.endCursor');\n\n// ── Second tranche enums (BOFF-11426) ───────────────────────────────────────\n\nexport const DashboardLayoutEnum = z.enum(['FLEX', 'GRID', 'TABS']).describe('Dashboard layout');\n\nexport const PipelineStatusEnum = z\n .enum(['active', 'draft', 'error', 'inactive'])\n .describe('Pipeline status');\n\nexport const WorkflowStatusEnum = z\n .enum(['active', 'archived', 'draft', 'error', 'paused'])\n .describe('Workflow status');\n\nexport const PromptGenerationStatusEnum = z\n .enum(['PENDING', 'PROCESSING', 'GENERATING', 'COMPLETED', 'FAILED', 'CANCELLED'])\n .describe('Generation status');\n","/**\n * Shared plumbing for the second tranche of BigConsole tools (BOFF-11426): the annotation\n * presets, the one-line GraphQL call, and a transport-error message that cannot leak variables.\n *\n * Annotations are declared on every tool rather than inferred from the tool name, because name\n * inference misses verbs such as `execute`, `refresh`, `invalidate` and `duplicate` (the gap that\n * left store_cart_checkout ungated, BOFF-10861).\n */\n\nimport { errorResult, jsonResult, type McpContext, type ToolResult } from '../../../core/index.js';\nimport { WORKSPACE_NOTE } from './shared.js';\n\n/** Changes nothing. */\nexport const READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n} as const;\n\n/** Creates or changes something. No tool in this module deletes, archives or publishes. */\nexport const WRITE = { readOnlyHint: false, destructiveHint: false } as const;\n\n/** A write that also reaches a system outside BigConsole (an external workflow engine). */\nexport const WRITE_EXTERNAL = {\n readOnlyHint: false,\n destructiveHint: false,\n openWorldHint: true,\n} as const;\n\n/** Tool description with the workspace note every BigConsole tool carries. */\nexport function describeTool(text: string): string {\n return `${text} ${WORKSPACE_NOTE}`;\n}\n\n/**\n * graphql-request's ClientError builds its `message` as\n * `<gql error>: ${JSON.stringify({ response, request })}`, and `request` carries the operation's\n * variables. A pipeline stage or a data sink refresh can carry connection parameters, so a\n * transport error's own message must never reach the log or the MCP client: report only the\n * GraphQL error messages from the response. Same defect class as BOFF-7165.\n */\nfunction isClientErrorShape(\n error: unknown,\n): error is { response?: { errors?: { message?: string }[]; status?: number } } {\n return typeof error === 'object' && error !== null && 'response' in error && 'request' in error;\n}\n\nexport function safeErrorMessage(error: unknown): string {\n if (isClientErrorShape(error)) {\n const errors = error.response?.errors;\n if (Array.isArray(errors) && errors.length > 0) {\n const joined = errors\n .map((e) => e?.message)\n .filter((m): m is string => typeof m === 'string' && m.length > 0)\n .join('; ');\n if (joined) return joined;\n }\n const status = error.response?.status;\n return status === undefined ? 'GraphQL request failed' : `GraphQL error (status ${status})`;\n }\n return error instanceof Error ? error.message : String(error);\n}\n\n/** Copy only the defined (non-undefined) entries into a fresh object. */\nexport function definedInput(obj: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) out[key] = value;\n }\n return out;\n}\n\n/**\n * Send one document to the workspace gateway and return the value of its root field as JSON.\n * `label` is the tool name without the product prefix, used in the error text and the log.\n */\nexport async function gqlCall(\n ctx: McpContext,\n label: string,\n root: string,\n document: string,\n variables: Record<string, unknown>,\n): Promise<ToolResult> {\n try {\n const data = await ctx.gql.workspace.request<Record<string, unknown>>(document, variables);\n return jsonResult(data[root]);\n } catch (error) {\n const message = safeErrorMessage(error);\n ctx.logger.error(`bigconsole ${label} failed`, { error: message });\n return errorResult(`Failed (${label}): ${message}`);\n }\n}\n","/**\n * BigConsole dashboard (console) tools, including the export/import round-trip.\n *\n * Surface (9): dashboards_list, dashboard_get, dashboard_create, dashboard_update,\n * dashboard_clone, dashboards_search,\n * dashboard_page_create, dashboard_export, dashboard_import.\n *\n * ### \"Dashboards as code\" is the point of this module\n *\n * `dashboard_export` returns the Console Definition JSON — one declarative\n * document with the whole console (pages, widgets, layout, global filters).\n * `dashboard_import` reconstructs a console from that string. Round-trip them\n * and a coding agent can commit a console definition next to application code\n * and diff it in review; that workflow is the positioning no incumbent BI\n * vendor offers. Imported dashboards get REGENERATED ids — re-bind anything\n * that referenced the old dashboard by id.\n *\n * ### Lifecycle mutations are deliberately absent\n *\n * `archiveDashboard` / `restoreDashboard` / `publishDashboard` are not here:\n * archiving a production console is the destructive action v1 refuses to\n * expose to an external agent (AI_READINESS §2.2/§2.3). Read + create +\n * export/import is the valuable 90%.\n *\n * ### Selection sets stay slim (BOFF-2719 / BOFF-2720)\n *\n * Lists select scalar metadata only. `dashboard_get` pages through at most\n * 20 pages with per-page widget counts — it never expands widget configs,\n * which is what tripped the gateway cost limit in production.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport {\n jsonResult,\n textResult,\n errorResult,\n mcpToolName,\n type McpContext,\n} from '../../../core/index.js';\nimport {\n CLONE_DASHBOARD,\n CREATE_DASHBOARD,\n CREATE_DASHBOARD_PAGE,\n EXPORT_DASHBOARD,\n GET_DASHBOARD,\n IMPORT_DASHBOARD,\n LIST_DASHBOARDS,\n SEARCH_DASHBOARDS,\n UPDATE_DASHBOARD,\n VALIDATE_DASHBOARD_IMPORT,\n} from '../operations.js';\nimport {\n DashboardCategoryEnum,\n DashboardLayoutEnum,\n DashboardVisibilityEnum,\n PageCursor,\n PageSize,\n WORKSPACE_NOTE,\n} from './shared.js';\nimport { READ_ONLY, WRITE, definedInput, describeTool, gqlCall } from './call.js';\n\nexport function registerDashboardTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboards_list')),\n {\n title: 'List Dashboards',\n description:\n 'The dashboards (consoles) visible in the active workspace — metadata only, no widget ' +\n `configs. ${WORKSPACE_NOTE}`,\n inputSchema: {\n first: PageSize,\n after: PageCursor,\n search: z.string().optional().describe('Filter by name substring'),\n category: DashboardCategoryEnum.optional(),\n visibility: DashboardVisibilityEnum.optional(),\n includeArchived: z\n .boolean()\n .optional()\n .describe('Include archived dashboards (excluded by default)'),\n },\n },\n async ({ first, after, search, category, visibility, includeArchived }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n listDashboards: Record<string, unknown>;\n }>(LIST_DASHBOARDS, {\n first: first ?? 20,\n after: after ?? null,\n search: search ?? null,\n category: category ?? null,\n visibility: visibility ?? null,\n includeArchived: includeArchived ?? null,\n });\n return jsonResult(data.listDashboards);\n } catch (error) {\n ctx.logger.error('bigconsole dashboards_list failed', { error: String(error) });\n return errorResult(\n `Failed to list dashboards: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_get')),\n {\n title: 'Get Dashboard',\n description:\n 'One dashboard with its pages (ids — you need the page id to place widgets), global ' +\n 'filters, and page/widget counts. Widget configs are NOT expanded (gateway cost ' +\n 'limit). ' +\n WORKSPACE_NOTE,\n inputSchema: {\n id: z.string().describe('Dashboard ID'),\n },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n getDashboard: Record<string, unknown> | null;\n }>(GET_DASHBOARD, { id });\n if (!data.getDashboard) {\n return errorResult(`Dashboard \"${id}\" not found or not visible.`);\n }\n return jsonResult(data.getDashboard);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_get failed', { error: String(error) });\n return errorResult(\n `Failed to get the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_create')),\n {\n title: 'Create Dashboard',\n description:\n 'Create a console (dashboard). `createDefaultPage` defaults to true, so a first page is ' +\n 'created for you — read its id back via dashboard_get to place widgets. Step 2 of the ' +\n 'pipeline (DataSink → Dashboard → Parser → Widget). ' +\n WORKSPACE_NOTE,\n inputSchema: {\n name: z.string().describe('Dashboard name'),\n category: DashboardCategoryEnum,\n description: z.string().optional(),\n visibility: DashboardVisibilityEnum.optional(),\n createDefaultPage: z.boolean().optional().describe('Create a first page (default true)'),\n },\n },\n async ({ name, category, description, visibility, createDefaultPage }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n createBigConsoleDashboard: Record<string, unknown>;\n }>(CREATE_DASHBOARD, {\n input: {\n name,\n category,\n ...(description !== undefined ? { description } : {}),\n ...(visibility !== undefined ? { visibility } : {}),\n ...(createDefaultPage !== undefined ? { createDefaultPage } : {}),\n },\n });\n return jsonResult(result.createBigConsoleDashboard);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_page_create')),\n {\n title: 'Create Dashboard Page',\n description:\n 'Add a page to an existing dashboard. Only needed for multi-page consoles — a new ' +\n 'dashboard already has a default page. Widgets are placed on a page, not on the ' +\n 'dashboard. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n dashboardId: z.string().describe('Parent dashboard ID'),\n name: z.string().describe('Page name'),\n },\n },\n async ({ dashboardId, name }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n createDashboardPage: Record<string, unknown>;\n }>(CREATE_DASHBOARD_PAGE, { input: { dashboardId, name } });\n return jsonResult(result.createDashboardPage);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_page_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the page: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_export')),\n {\n title: 'Export Dashboard (Console Definition JSON)',\n description:\n 'Export a dashboard as the portable Console Definition JSON — one declarative document ' +\n 'with pages, widgets, layout and global filters. Commit it next to your code, diff it ' +\n 'in review, feed it to dashboard_import to reconstruct. This is a QUERY, not a mutation. ' +\n 'Leave includeWebhookMappings false unless you hold dashboard-edit permission AND a ' +\n 'current export consent grant. ' +\n WORKSPACE_NOTE,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n inputSchema: {\n id: z.string().describe('Dashboard ID to export'),\n prettyPrint: z.boolean().optional().describe('Pretty-print the JSON (default true)'),\n includeDataSourceRefs: z\n .boolean()\n .optional()\n .describe('Include data source references (default false)'),\n includeWebhookMappings: z\n .boolean()\n .optional()\n .describe(\n 'Include webhook mappings (default false; requires dashboard-edit permission and a ' +\n 'current export consent grant — never request casually)',\n ),\n },\n },\n async ({ id, prettyPrint, includeDataSourceRefs, includeWebhookMappings }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n exportDashboard: string;\n }>(EXPORT_DASHBOARD, {\n id,\n options: {\n prettyPrint: prettyPrint ?? true,\n includeDataSourceRefs: includeDataSourceRefs ?? false,\n includeWebhookMappings: includeWebhookMappings ?? false,\n },\n });\n return textResult(data.exportDashboard);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_export failed', { error: String(error) });\n return errorResult(\n `Failed to export the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_import')),\n {\n title: 'Import Dashboard (Console Definition JSON)',\n description:\n 'Reconstruct a dashboard from a Console Definition JSON string (from dashboard_export). ' +\n 'This is the cross-workspace move: export in one workspace, import the string in ' +\n 'another. Uses the v2.0 import path with per-entity stats — do NOT pair an export with ' +\n 'the legacy importDashboard mutation, which expects the deprecated v1 layout and ' +\n 'silently imports an empty dashboard. Imported ids are REGENERATED — re-bind anything ' +\n 'that referenced the old dashboard by id. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n content: z.string().describe('The Console Definition JSON string'),\n name: z.string().optional().describe('Override the dashboard name'),\n visibility: DashboardVisibilityEnum.optional(),\n skipWarnings: z\n .boolean()\n .optional()\n .describe('Import despite non-blocking validation warnings (default false)'),\n },\n },\n async ({ content, name, visibility, skipWarnings }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n importBigConsoleDashboard: {\n success: boolean;\n errorMessage?: string | null;\n dashboard?: Record<string, unknown> | null;\n stats?: Record<string, unknown> | null;\n };\n }>(IMPORT_DASHBOARD, {\n input: {\n content,\n ...(name !== undefined ? { name } : {}),\n ...(visibility !== undefined ? { visibility } : {}),\n ...(skipWarnings !== undefined ? { skipWarnings } : {}),\n },\n });\n if (!result.importBigConsoleDashboard.success) {\n // The v2 importer refuses to create when the definition carries\n // non-blocking warnings until the caller passes skipWarnings: true.\n // Fetch the validation detail so the agent can SEE the warnings and\n // make an informed acknowledge-or-fix decision.\n let detail = '';\n try {\n const validation = await ctx.gql.workspace.request<{\n validateDashboardImport: {\n errors: Array<{ code: string; message: string }>;\n warnings: Array<{ code: string; message: string; suggestion?: string | null }>;\n };\n }>(VALIDATE_DASHBOARD_IMPORT, { content });\n const lines: string[] = [];\n for (const e of validation.validateDashboardImport.errors ?? []) {\n lines.push(`error ${e.code}: ${e.message}`);\n }\n for (const w of validation.validateDashboardImport.warnings ?? []) {\n lines.push(\n `warning ${w.code}: ${w.message}${w.suggestion ? ` (${w.suggestion})` : ''}`,\n );\n }\n if (lines.length > 0) detail = ` Validation says: ${lines.join(' | ')}`;\n } catch {\n // validation fetch is best-effort; the raw errorMessage still stands\n }\n return errorResult(\n `Import failed: ${result.importBigConsoleDashboard.errorMessage ?? 'unknown error'}.${detail}`,\n 'Read the errors/warnings above; fix the definition, or re-call with skipWarnings: ' +\n 'true ONLY if every warning is understood and acceptable.',\n );\n }\n return jsonResult(result.importBigConsoleDashboard);\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_import failed', { error: String(error) });\n return errorResult(\n `Failed to import the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_update')),\n {\n title: 'Update Dashboard',\n description: describeTool(\n \"Update a dashboard's name, description, category, visibility, layout or tags. Only the \" +\n 'fields you pass change. It cannot archive, restore or publish the dashboard.',\n ),\n annotations: WRITE,\n inputSchema: {\n id: z.string().describe('Dashboard ID'),\n name: z.string().optional().describe('New dashboard name'),\n description: z.string().optional().describe('New description'),\n category: DashboardCategoryEnum.optional(),\n visibility: DashboardVisibilityEnum.optional(),\n layout: DashboardLayoutEnum.optional(),\n tagIds: z.array(z.string()).optional().describe('Replacement tag IDs'),\n },\n },\n async (args) =>\n gqlCall(ctx, 'dashboard_update', 'updateBigConsoleDashboard', UPDATE_DASHBOARD, {\n input: definedInput(args),\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_clone')),\n {\n title: 'Clone Dashboard',\n description: describeTool(\n 'Copy a dashboard under a new name, optionally with its widgets and comments. The copy ' +\n 'is not shared with anyone the original was shared with.',\n ),\n annotations: WRITE,\n inputSchema: {\n sourceDashboardId: z.string().describe('Dashboard to copy'),\n name: z.string().describe('Name of the copy'),\n includeWidgets: z.boolean().optional().describe('Copy the widgets too'),\n includeComments: z.boolean().optional().describe('Copy the comments too'),\n },\n },\n async (args) =>\n gqlCall(ctx, 'dashboard_clone', 'cloneDashboard', CLONE_DASHBOARD, {\n input: definedInput(args),\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboards_search')),\n {\n title: 'Search Dashboards',\n description: describeTool(\n 'Search dashboards by name and description text, with optional category and visibility ' +\n 'filters. Returns a plain list (no totals); page with first and after.',\n ),\n annotations: READ_ONLY,\n inputSchema: {\n query: z.string().describe('Search text'),\n category: DashboardCategoryEnum.optional(),\n visibility: DashboardVisibilityEnum.optional(),\n first: PageSize,\n after: PageCursor,\n },\n },\n async ({ query, category, visibility, first, after }) =>\n gqlCall(ctx, 'dashboards_search', 'searchDashboards', SEARCH_DASHBOARDS, {\n query,\n first: first ?? 20,\n ...definedInput({ category, visibility, after }),\n }),\n );\n}\n","/**\n * BigConsole data sink tools — the data layer of the console pipeline.\n *\n * Surface (6): datasinks_list, datasink_get, datasink_create, datasink_update,\n * datasink_refresh, datasink_invalidate_cache.\n *\n * Read + create/update only — there is intentionally no `datasink_delete`:\n * sinks can feed live workflows and parsers, and an external agent retiring\n * one it does not fully understand is exactly the destructive action v1\n * omits (AI_READINESS §2.3).\n *\n * `datasink_get` never selects the `data` payload — sinks can hold arbitrary\n * bulk rows, and the MCP surface exists to author consoles, not to exfiltrate\n * data. No tool here returns sink rows (there is no `getDataSinkData` tool); use the app\n * when you actually need rows.\n *\n * `datasink_update` carries the optimistic-lock `version` INSIDE the input\n * (the backend's shape) and requires it as a tool input — see shared.ts.\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 CREATE_DATA_SINK,\n GET_DATA_SINK,\n INVALIDATE_DATA_SINK_CACHE,\n LIST_DATA_SINKS,\n REFRESH_DATA_SINK,\n UPDATE_DATA_SINK,\n} from '../operations.js';\nimport {\n DataSinkKey,\n DataSinkStatusEnum,\n PageCursor,\n PageSize,\n VersionInt,\n VERSION_OMITTED_MESSAGE,\n WORKSPACE_NOTE,\n} from './shared.js';\nimport { WRITE, definedInput, describeTool, gqlCall } from './call.js';\n\nexport function registerDataSinkTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasinks_list')),\n {\n title: 'List Data Sinks',\n description:\n 'The data sinks of the active workspace with status and refresh metadata — metadata ' +\n `only, never payloads. ${WORKSPACE_NOTE}`,\n inputSchema: {\n first: PageSize,\n after: PageCursor,\n search: z.string().optional().describe('Filter by name or key substring'),\n status: DataSinkStatusEnum.optional(),\n },\n },\n async ({ first, after, search, status }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n listDataSinks: Record<string, unknown>;\n }>(LIST_DATA_SINKS, {\n first: first ?? 20,\n after: after ?? null,\n search: search ?? null,\n status: status ?? null,\n });\n return jsonResult(data.listDataSinks);\n } catch (error) {\n ctx.logger.error('bigconsole datasinks_list failed', { error: String(error) });\n return errorResult(\n `Failed to list data sinks: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasink_get')),\n {\n title: 'Get Data Sink',\n description:\n 'One data sink by id or key (exactly one of them) — metadata, linked-parser count and ' +\n 'version for optimistic-lock updates. Does NOT return the stored data payload. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n id: z.string().optional().describe('Data sink ID'),\n key: z.string().optional().describe('Data sink key (slug) — alternative to id'),\n },\n },\n async ({ id, key }) => {\n if (!id && !key) {\n return errorResult(\n 'Provide exactly one of id or key.',\n 'Pass the data sink id from datasinks_list, or its key (slug).',\n );\n }\n if (id && key) {\n return errorResult('Provide exactly one of id or key, not both.');\n }\n try {\n const data = await ctx.gql.workspace.request<{\n getDataSink: Record<string, unknown> | null;\n }>(GET_DATA_SINK, { id: id ?? null, key: key ?? null });\n if (!data.getDataSink) {\n return errorResult(`Data sink not found for ${id ? `id \"${id}\"` : `key \"${key}\"`}.`);\n }\n return jsonResult(data.getDataSink);\n } catch (error) {\n ctx.logger.error('bigconsole datasink_get failed', { error: String(error) });\n return errorResult(\n `Failed to get the data sink: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasink_create')),\n {\n title: 'Create Data Sink',\n description:\n 'Create a data sink — the first step of the console pipeline (DataSink → Dashboard → ' +\n 'Parser → Widget). `key` is the only required field; pass `data` as an array of row ' +\n 'objects for a snapshot, or leave it empty and feed the sink from a workflow later. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n key: DataSinkKey,\n name: z.string().optional().describe('Display name (defaults to the key)'),\n description: z.string().optional(),\n data: z\n .unknown()\n .optional()\n .describe('Initial payload — an array of row objects for a snapshot load'),\n ttl: z.number().int().min(0).optional().describe('Cache TTL in seconds (default 300)'),\n },\n },\n async ({ key, name, description, data, ttl }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n createDataSink: Record<string, unknown>;\n }>(CREATE_DATA_SINK, {\n input: {\n key,\n ...(name !== undefined ? { name } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(data !== undefined ? { data } : {}),\n ...(ttl !== undefined ? { ttl } : {}),\n },\n });\n return jsonResult(result.createDataSink);\n } catch (error) {\n ctx.logger.error('bigconsole datasink_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the data sink: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasink_update')),\n {\n title: 'Update Data Sink',\n description:\n 'Update a data sink with optimistic locking. `version` is REQUIRED — read the current ' +\n 'value from datasink_get first and send it back unchanged; a stale version is rejected, ' +\n 'so re-read and retry rather than incrementing blindly. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n id: z.string().describe('Data sink ID'),\n version: VersionInt.optional(),\n name: z.string().optional(),\n description: z.string().optional(),\n data: z.unknown().optional().describe('Replacement payload (array of row objects)'),\n ttl: z.number().int().min(0).optional(),\n isActive: z.boolean().optional(),\n },\n },\n async ({ id, version, name, description, data, ttl, isActive }) => {\n if (version === undefined) {\n return errorResult(VERSION_OMITTED_MESSAGE);\n }\n try {\n const result = await ctx.gql.workspace.request<{\n updateDataSink: Record<string, unknown>;\n }>(UPDATE_DATA_SINK, {\n input: {\n id,\n version,\n ...(name !== undefined ? { name } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(data !== undefined ? { data } : {}),\n ...(ttl !== undefined ? { ttl } : {}),\n ...(isActive !== undefined ? { isActive } : {}),\n },\n });\n return jsonResult(result.updateDataSink);\n } catch (error) {\n ctx.logger.error('bigconsole datasink_update failed', { error: String(error) });\n return errorResult(\n `Failed to update the data sink: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasink_refresh')),\n {\n title: 'Refresh Data Sink',\n description: describeTool(\n 'Pull fresh data into a sink from its source now. Give id or key. Returns the sink ' +\n 'status and when it was last refreshed, not the rows.',\n ),\n annotations: WRITE,\n inputSchema: {\n id: z.string().optional().describe('Data sink ID'),\n key: z.string().optional().describe('Data sink key — alternative to id'),\n forceRefresh: z.boolean().optional().describe('Ignore the cache TTL'),\n queryParams: z.record(z.string(), z.unknown()).optional().describe('Source query params'),\n },\n },\n async (args) => {\n if ((args.id === undefined) === (args.key === undefined)) {\n return errorResult('Provide exactly one of id or key.');\n }\n return gqlCall(ctx, 'datasink_refresh', 'refreshDataSink', REFRESH_DATA_SINK, {\n input: definedInput(args),\n });\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'datasink_invalidate_cache')),\n {\n title: 'Invalidate Data Sink Cache',\n description: describeTool(\n 'Drop the cached data of one sink (id) or, with no id, of every sink in the workspace. ' +\n 'The next read fetches from the source again. Stored data is not deleted.',\n ),\n annotations: WRITE,\n inputSchema: { id: z.string().optional().describe('Data sink ID; omit for all sinks') },\n },\n async ({ id }) =>\n gqlCall(\n ctx,\n 'datasink_invalidate_cache',\n 'invalidateDataSinkCache',\n INVALIDATE_DATA_SINK_CACHE,\n definedInput({ id }),\n ),\n );\n}\n","/**\n * BigConsole generate-from-prompt tool — the AI console lifecycle.\n *\n * Surface (1): dashboard_generate_from_prompt.\n *\n * Runs the whole lifecycle in one call: submit the generation, poll it to a\n * terminal status (PENDING → PROCESSING → GENERATING → COMPLETED | FAILED |\n * CANCELLED), then — only when `materialize` is explicitly true — turn the\n * completed spec into a real dashboard via createDashboardFromGeneration.\n *\n * ### Metering and defaults\n *\n * `generateDashboardFromPrompt` and `createDashboardFromGeneration` are\n * `@usage`-metered (they spend the workspace's AI credits). `materialize`\n * therefore defaults to FALSE: the default path spends exactly one\n * generation and hands the agent the spec digest to review, and turning it\n * into a dashboard is an explicit second decision. Pass the exact\n * `generatedSpecDigest` this tool returns back as `expectedSpecDigest` with\n * `materialize: true` so linked reuse refuses an obsolete revision instead of\n * silently materializing a changed spec.\n *\n * A generated console arrives bound to whatever the spec says — verify widget\n * bindings against the workspace's real data sinks (datasinks_list) before\n * trusting it as live.\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 CREATE_DASHBOARD_FROM_GENERATION,\n GENERATE_DASHBOARD_FROM_PROMPT,\n GET_PROMPT_GENERATION,\n} from '../operations.js';\nimport {\n DashboardCategoryEnum,\n DashboardVisibilityEnum,\n WidgetTypeArray,\n WORKSPACE_NOTE,\n} from './shared.js';\n\nconst TERMINAL_STATUSES = ['COMPLETED', 'FAILED', 'CANCELLED'] as const;\n\nconst TERMINAL_SET: ReadonlySet<string> = new Set(TERMINAL_STATUSES);\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport function registerGenerateTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'dashboard_generate_from_prompt')),\n {\n title: 'Generate Dashboard From Prompt',\n description:\n 'Generate a whole console spec from natural language, poll it to completion, and ' +\n 'optionally materialize it into a real dashboard. Metered (spends AI credits): ' +\n 'generating always costs one generation; materialization only happens when ' +\n '`materialize: true`, and should pass the returned generatedSpecDigest back as ' +\n 'expectedSpecDigest so an obsolete spec revision is refused. After materializing, ' +\n \"verify widget bindings against the workspace's real data sinks. \" +\n WORKSPACE_NOTE,\n inputSchema: {\n prompt: z\n .string()\n .describe(\n 'Natural language description of the desired console, e.g. \"a sales dashboard with ' +\n 'revenue trends, top products and regional performance\"',\n ),\n maxWidgets: z\n .number()\n .int()\n .min(1)\n .max(24)\n .optional()\n .describe('Maximum widgets to generate (default 8)'),\n category: DashboardCategoryEnum.optional(),\n preferredWidgetTypes: z\n .array(z.string())\n .optional()\n .describe(\n 'Preferred widget types (from the nine render-verified types; any other value is ' +\n 'rejected with the full list)',\n ),\n additionalContext: z.string().optional(),\n visibility: DashboardVisibilityEnum.optional(),\n materialize: z\n .boolean()\n .optional()\n .describe(\n 'Materialize the completed spec into a real dashboard (default false; metered — ' +\n 'review the generatedSpecDigest first)',\n ),\n expectedSpecDigest: z\n .string()\n .optional()\n .describe(\n 'The exact generatedSpecDigest this tool returned, passed back so an obsolete spec ' +\n 'revision is refused (only used with materialize: true)',\n ),\n pollIntervalMs: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Poll interval while the generation runs (default 2000ms)'),\n pollTimeoutMs: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Give up polling after this long (default 120000ms)'),\n },\n },\n async ({\n prompt,\n maxWidgets,\n category,\n preferredWidgetTypes,\n additionalContext,\n visibility,\n materialize,\n expectedSpecDigest,\n pollIntervalMs,\n pollTimeoutMs,\n }) => {\n const parsedTypes = preferredWidgetTypes\n ? WidgetTypeArray.safeParse(preferredWidgetTypes)\n : null;\n if (parsedTypes && !parsedTypes.success) {\n return errorResult(\n parsedTypes.error.issues.map((issue) => issue.message).join(' '),\n 'Use only the nine render-verified widget types named in the message.',\n );\n }\n if (expectedSpecDigest && materialize !== true) {\n return errorResult(\n 'expectedSpecDigest is only meaningful with materialize: true.',\n 'Review the generatedSpecDigest from the result, then re-call with materialize: true ' +\n 'and the digest.',\n );\n }\n\n const interval = pollIntervalMs ?? 2000;\n const timeout = pollTimeoutMs ?? 120_000;\n\n let generation: {\n id: string;\n status: string;\n errorMessage?: string | null;\n generatedSpecDigest?: string | null;\n dashboardId?: string | null;\n } | null = null;\n\n try {\n const submitted = await ctx.gql.workspace.request<{\n generateDashboardFromPrompt: { id: string; status: string };\n }>(GENERATE_DASHBOARD_FROM_PROMPT, {\n input: {\n prompt,\n ...(maxWidgets !== undefined ? { maxWidgets } : {}),\n ...(category !== undefined ? { category } : {}),\n ...(parsedTypes?.data ? { preferredWidgetTypes: parsedTypes.data } : {}),\n ...(additionalContext !== undefined ? { additionalContext } : {}),\n ...(visibility !== undefined ? { visibility } : {}),\n },\n });\n\n const generationId = submitted.generateDashboardFromPrompt.id;\n const deadline = Date.now() + timeout;\n\n for (;;) {\n const polled = await ctx.gql.workspace.request<{\n getPromptGeneration: {\n id: string;\n status: string;\n errorMessage?: string | null;\n generatedSpecDigest?: string | null;\n dashboardId?: string | null;\n } | null;\n }>(GET_PROMPT_GENERATION, { id: generationId });\n\n generation = polled.getPromptGeneration ?? {\n id: generationId,\n status: 'MISSING',\n errorMessage: 'Generation record vanished while polling.',\n };\n\n if (TERMINAL_SET.has(generation.status) || Date.now() >= deadline) break;\n await sleep(interval);\n }\n } catch (error) {\n ctx.logger.error('bigconsole dashboard_generate_from_prompt failed', {\n error: String(error),\n });\n return errorResult(\n `Failed to generate the dashboard: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n if (!generation) {\n return errorResult('Generation did not return a record — try again.');\n }\n\n if (!TERMINAL_SET.has(generation.status)) {\n return jsonResult({\n generationId: generation.id,\n status: generation.status,\n note:\n 'Still running when the poll budget ran out — the generation continues server-side; ' +\n 're-check from the app or re-run with a larger pollTimeoutMs before materializing.',\n });\n }\n if (generation.status === 'FAILED' || generation.status === 'CANCELLED') {\n return errorResult(\n `Generation ${generation.status.toLowerCase()}${generation.errorMessage ? `: ${generation.errorMessage}` : '.'}`,\n 'Fix the prompt (or the workspace state) and submit a new generation — re-running a ' +\n 'failed one just spends another credit.',\n );\n }\n\n // COMPLETED\n const base = {\n generationId: generation.id,\n status: generation.status,\n generatedSpecDigest: generation.generatedSpecDigest ?? null,\n };\n\n if (materialize !== true) {\n return jsonResult({\n ...base,\n materialized: false,\n next:\n 'Review the generated spec, then re-call with materialize: true and pass ' +\n 'generatedSpecDigest as expectedSpecDigest to create the dashboard.',\n });\n }\n\n try {\n const created = await ctx.gql.workspace.request<{\n createDashboardFromGeneration: Record<string, unknown>;\n }>(CREATE_DASHBOARD_FROM_GENERATION, {\n input: {\n generationId: generation.id,\n ...(expectedSpecDigest !== undefined ? { expectedSpecDigest } : {}),\n },\n });\n return jsonResult({\n ...base,\n materialized: true,\n dashboard: created.createDashboardFromGeneration,\n });\n } catch (error) {\n ctx.logger.error('bigconsole dashboard materialization failed', { error: String(error) });\n return errorResult(\n `Generation completed but materialization failed: ${error instanceof Error ? error.message : String(error)}`,\n 'The spec is still there — re-call with materialize: true and the same ' +\n 'generatedSpecDigest as expectedSpecDigest.',\n );\n }\n },\n );\n}\n","/**\n * BigConsole workflow tools (BOFF-11426).\n *\n * Surface (7): linked_workflow_get, linked_workflows_list, linked_workflow_get_by_key,\n * linked_workflow_data_sink_links, linked_workflow_create, linked_workflow_update,\n * linked_workflow_execute.\n *\n * These are the workflows registered *in BigConsole* (`Query.workflow`, `Query.workflows`): a\n * record that links an external FluidGrids workflow to data sinks so a run can feed them. They\n * are not the FluidGrids workflow definitions the fluidgrids module serves (`workflows_*`), which\n * is why the tool names say `linked_workflow` and never collide with that module.\n *\n * The selections leave out `webhookUrl` and the opaque `config` (it can carry the external\n * engine's settings). `deleteWorkflow` is deliberately absent, like every delete in this module.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { errorResult, mcpToolName, type McpContext } from '../../../core/index.js';\nimport {\n CREATE_LINKED_WORKFLOW,\n EXECUTE_LINKED_WORKFLOW,\n GET_LINKED_WORKFLOW,\n GET_LINKED_WORKFLOW_BY_KEY,\n LIST_LINKED_WORKFLOW_DATA_SINK_LINKS,\n LIST_LINKED_WORKFLOWS,\n UPDATE_LINKED_WORKFLOW,\n} from '../operations.js';\nimport { READ_ONLY, WRITE, WRITE_EXTERNAL, definedInput, describeTool, gqlCall } from './call.js';\nimport { DataSinkKey, VersionInt, VERSION_OMITTED_MESSAGE, WorkflowStatusEnum } from './shared.js';\n\nexport function registerLinkedWorkflowTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'linked_workflow_get')),\n {\n title: 'Get Linked Workflow',\n description: describeTool(\n 'One BigConsole workflow by ID, with its current version. These are the workflows ' +\n 'registered in BigConsole to feed data sinks, not FluidGrids workflow definitions. ' +\n 'The webhook URL and config are not returned.',\n ),\n annotations: READ_ONLY,\n inputSchema: { id: z.string().describe('Workflow ID') },\n },\n async ({ id }) => gqlCall(ctx, 'linked_workflow_get', 'workflow', GET_LINKED_WORKFLOW, { id }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'linked_workflows_list')),\n {\n title: 'List Linked Workflows',\n description: describeTool(\n 'The BigConsole workflows in the workspace, filtered by key, status or search text. The ' +\n 'list is not paged.',\n ),\n annotations: READ_ONLY,\n inputSchema: {\n key: z.string().optional().describe('Exact workflow key'),\n status: WorkflowStatusEnum.optional(),\n searchQuery: z.string().optional().describe('Search text'),\n },\n },\n async ({ key, status, searchQuery }) => {\n const filter = definedInput({ key, status, searchQuery });\n return gqlCall(\n ctx,\n 'linked_workflows_list',\n 'workflows',\n LIST_LINKED_WORKFLOWS,\n Object.keys(filter).length > 0 ? { filter } : {},\n );\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'linked_workflow_get_by_key')),\n {\n title: 'Get Linked Workflow By Key',\n description: describeTool('One BigConsole workflow by its unique key.'),\n annotations: READ_ONLY,\n inputSchema: { key: z.string().describe('Workflow key') },\n },\n async ({ key }) =>\n gqlCall(ctx, 'linked_workflow_get_by_key', 'workflowByKey', GET_LINKED_WORKFLOW_BY_KEY, {\n key,\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'linked_workflow_data_sink_links')),\n {\n title: 'List Linked Workflow Data Sink Links',\n description: describeTool(\n \"The data sinks a BigConsole workflow feeds, with each link's priority, mapping and \" +\n 'whether it is enabled.',\n ),\n annotations: READ_ONLY,\n inputSchema: { workflowId: z.string().describe('Workflow ID') },\n },\n async ({ workflowId }) =>\n gqlCall(\n ctx,\n 'linked_workflow_data_sink_links',\n 'workflowDataSinkLinks',\n LIST_LINKED_WORKFLOW_DATA_SINK_LINKS,\n { workflowId },\n ),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'linked_workflow_create')),\n {\n title: 'Create Linked Workflow',\n description: describeTool(\n 'Register a BigConsole workflow. key and name are required. Link it to an external ' +\n 'FluidGrids workflow with externalWorkflowId and to data sinks with dataSinkKeys.',\n ),\n annotations: WRITE,\n inputSchema: {\n key: z.string().describe('Unique workflow key'),\n name: z.string().describe('Workflow name'),\n description: z.string().optional().describe('What the workflow does'),\n externalWorkflowId: z.string().optional().describe('FluidGrids workflow to link'),\n dataSinkKeys: z.array(DataSinkKey).optional().describe('Data sinks the workflow feeds'),\n status: WorkflowStatusEnum.optional(),\n config: z.record(z.string(), z.unknown()).optional().describe('Workflow settings'),\n },\n },\n async (args) =>\n gqlCall(ctx, 'linked_workflow_create', 'createWorkflow', CREATE_LINKED_WORKFLOW, {\n input: definedInput(args),\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'linked_workflow_update')),\n {\n title: 'Update Linked Workflow',\n description: describeTool(\n 'Update a BigConsole workflow with optimistic locking. `version` is REQUIRED — read it ' +\n 'from linked_workflow_get first and send it back unchanged; a stale version is ' +\n 'rejected, so re-read and retry.',\n ),\n annotations: WRITE,\n inputSchema: {\n id: z.string().describe('Workflow ID'),\n version: VersionInt.optional(),\n name: z.string().optional().describe('New name'),\n description: z.string().optional().describe('New description'),\n status: WorkflowStatusEnum.optional(),\n config: z.record(z.string(), z.unknown()).optional().describe('Replacement settings'),\n },\n },\n async ({ id, version, ...fields }) => {\n if (version === undefined) return errorResult(VERSION_OMITTED_MESSAGE);\n return gqlCall(ctx, 'linked_workflow_update', 'updateWorkflow', UPDATE_LINKED_WORKFLOW, {\n id,\n version,\n input: definedInput(fields),\n });\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'linked_workflow_execute')),\n {\n title: 'Execute Linked Workflow',\n description: describeTool(\n 'Run a BigConsole workflow now, passing optional trigger data. It starts the linked ' +\n 'external workflow, which can change data in the sinks it feeds and reach other ' +\n 'systems, so confirm with the user before running one you did not create.',\n ),\n annotations: WRITE_EXTERNAL,\n inputSchema: {\n id: z.string().describe('Workflow ID'),\n triggerData: z.unknown().optional().describe('Payload passed to the workflow'),\n },\n },\n async (args) =>\n gqlCall(\n ctx,\n 'linked_workflow_execute',\n 'executeWorkflow',\n EXECUTE_LINKED_WORKFLOW,\n definedInput(args),\n ),\n );\n}\n","/**\n * BigConsole parser tools — the shaping layer of the pipeline.\n *\n * Surface (6): parsers_list, parser_get, parser_execute, parser_create, parser_update,\n * parser_test_expression.\n *\n * A parser transforms a data sink's rows into the shape a widget renders:\n * `jq` / `jsonata` / `spark` over the sink's payload, read by `inputSinkKey`\n * (the slug, NOT the id), written to `outputKey`, scoped to a console via\n * `consoleId` — which is the DASHBOARD id. Parsers are optional: if sink rows\n * are already chart-shaped, bind the widget straight to the sink.\n *\n * `parser_test_expression` runs the expression server-side against a stored\n * sink (by id or key) or inline sample rows, so an agent can iterate on the\n * expression before creating anything.\n *\n * `parser_update` takes the optimistic-lock `version` as a required top-level\n * tool input (the backend's shape differs from updateDataSink's in-input\n * version) — see shared.ts.\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 CREATE_PARSER,\n EXECUTE_PARSER,\n GET_PARSER,\n LIST_PARSERS,\n TEST_PARSER_EXPRESSION,\n UPDATE_PARSER,\n} from '../operations.js';\nimport {\n PageCursor,\n PageSize,\n ParserStatusEnum,\n ParserTypeEnum,\n VersionInt,\n VERSION_OMITTED_MESSAGE,\n WORKSPACE_NOTE,\n} from './shared.js';\nimport { READ_ONLY, WRITE, describeTool, gqlCall } from './call.js';\n\nexport function registerParserTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parsers_list')),\n {\n title: 'List Parsers',\n description:\n 'The parsers of one console. `consoleId` is the DASHBOARD id (not the workspace id, ' +\n 'not a page id) — parsers belong to the whole console. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n consoleId: z.string().describe('Dashboard (console) ID'),\n first: PageSize,\n after: PageCursor,\n },\n },\n async ({ consoleId, first, after }) => {\n try {\n const data = await ctx.gql.workspace.request<{\n listParsers: Record<string, unknown>;\n }>(LIST_PARSERS, { consoleId, first: first ?? 20, after: after ?? null });\n return jsonResult(data.listParsers);\n } catch (error) {\n ctx.logger.error('bigconsole parsers_list failed', { error: String(error) });\n return errorResult(\n `Failed to list parsers: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parser_create')),\n {\n title: 'Create Parser',\n description:\n 'Create a parser on a console. Step 3 of the pipeline (DataSink → Dashboard → Parser → ' +\n 'Widget). `consoleId` is the dashboard id; `inputSinkKey` is the data sink KEY (slug), ' +\n 'not its id; `outputKey` is a new slug the widget will read. Prefer type jq. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n consoleId: z.string().describe('Dashboard (console) ID'),\n name: z.string().describe('Parser name'),\n type: ParserTypeEnum,\n expression: z\n .string()\n .describe('Transform expression, e.g. jq: [.[] | {label: .grade, value: .present}]'),\n inputSinkKey: z\n .string()\n .describe('The data sink KEY (slug) the parser reads — not the sink id'),\n outputKey: z.string().describe('New slug for the parser output, e.g. sales_2026_chart'),\n description: z.string().optional(),\n ttl: z.number().int().min(0).optional(),\n },\n },\n async ({ consoleId, name, type, expression, inputSinkKey, outputKey, description, ttl }) => {\n try {\n const result = await ctx.gql.workspace.request<{\n createParser: Record<string, unknown>;\n }>(CREATE_PARSER, {\n input: {\n consoleId,\n name,\n type,\n expression,\n inputSinkKey,\n outputKey,\n ...(description !== undefined ? { description } : {}),\n ...(ttl !== undefined ? { ttl } : {}),\n },\n });\n return jsonResult(result.createParser);\n } catch (error) {\n ctx.logger.error('bigconsole parser_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the parser: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parser_update')),\n {\n title: 'Update Parser',\n description:\n 'Update a parser with optimistic locking. `version` is REQUIRED and is a top-level ' +\n 'argument (unlike the data sink, where it lives inside the input) — read the current ' +\n 'value from parsers_list first and send it back unchanged; a stale version is rejected, ' +\n 'so re-read and retry rather than incrementing blindly. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n id: z.string().describe('Parser ID'),\n version: VersionInt.optional(),\n name: z.string().optional(),\n expression: z.string().optional(),\n inputSinkKey: z.string().optional(),\n outputKey: z.string().optional(),\n description: z.string().optional(),\n ttl: z.number().int().min(0).optional(),\n status: ParserStatusEnum.optional(),\n },\n },\n async ({\n id,\n version,\n name,\n expression,\n inputSinkKey,\n outputKey,\n description,\n ttl,\n status,\n }) => {\n if (version === undefined) {\n return errorResult(VERSION_OMITTED_MESSAGE);\n }\n try {\n const result = await ctx.gql.workspace.request<{\n updateParser: Record<string, unknown>;\n }>(UPDATE_PARSER, {\n id,\n version,\n input: {\n ...(name !== undefined ? { name } : {}),\n ...(expression !== undefined ? { expression } : {}),\n ...(inputSinkKey !== undefined ? { inputSinkKey } : {}),\n ...(outputKey !== undefined ? { outputKey } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(ttl !== undefined ? { ttl } : {}),\n ...(status !== undefined ? { status } : {}),\n },\n });\n return jsonResult(result.updateParser);\n } catch (error) {\n ctx.logger.error('bigconsole parser_update failed', { error: String(error) });\n return errorResult(\n `Failed to update the parser: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parser_test_expression')),\n {\n title: 'Test Parser Expression',\n description:\n 'Run a parser expression server-side WITHOUT creating anything — against a stored data ' +\n 'sink (by id or key, preferred: the payload never crosses the wire to you) or against ' +\n 'inline sample rows. Iterate on the expression here, then parser_create. ' +\n WORKSPACE_NOTE,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n inputSchema: {\n type: ParserTypeEnum,\n expression: z.string().describe('Transform expression to test'),\n dataSinkId: z\n .string()\n .optional()\n .describe('Stored data sink ID to test against (preferred)'),\n dataSinkKey: z\n .string()\n .optional()\n .describe('Stored data sink key (slug) — alternative to dataSinkId'),\n sampleData: z\n .unknown()\n .optional()\n .describe(\n 'Inline sample payload (array of row objects) — alternative to a sink reference',\n ),\n sampleLimit: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Cap rows evaluated when testing against a stored sink'),\n },\n },\n async ({ type, expression, dataSinkId, dataSinkKey, sampleData, sampleLimit }) => {\n const refs = [dataSinkId, dataSinkKey, sampleData].filter((v) => v !== undefined).length;\n if (refs === 0) {\n return errorResult(\n 'Provide exactly one test target: dataSinkId, dataSinkKey, or sampleData.',\n 'Prefer a data sink reference so the payload stays server-side; use sampleData only ' +\n 'for the hand-edited-JSON path.',\n );\n }\n if (refs > 1) {\n return errorResult(\n 'dataSinkId, dataSinkKey and sampleData are mutually exclusive — provide exactly one.',\n );\n }\n try {\n const data = await ctx.gql.workspace.request<{\n testParserExpression: Record<string, unknown>;\n }>(TEST_PARSER_EXPRESSION, {\n input: {\n type,\n expression,\n ...(dataSinkId !== undefined ? { dataSinkId } : {}),\n ...(dataSinkKey !== undefined ? { dataSinkKey } : {}),\n ...(sampleData !== undefined ? { sampleData } : {}),\n ...(sampleLimit !== undefined ? { sampleLimit } : {}),\n },\n });\n return jsonResult(data.testParserExpression);\n } catch (error) {\n ctx.logger.error('bigconsole parser_test_expression failed', { error: String(error) });\n return errorResult(\n `Failed to test the expression: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parser_get')),\n {\n title: 'Get Parser',\n description: describeTool(\n 'One parser with its expression and current version. Read it before parser_update: the ' +\n 'update needs the version back unchanged.',\n ),\n annotations: READ_ONLY,\n inputSchema: { id: z.string().describe('Parser ID') },\n },\n async ({ id }) => gqlCall(ctx, 'parser_get', 'parser', GET_PARSER, { id }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'parser_execute')),\n {\n title: 'Execute Parser',\n description: describeTool(\n 'Run a stored parser against its input sink and write the result under its output key. Returns success, error and timing, not the output rows. ' +\n 'Use parser_test_expression first to try an expression without storing anything.',\n ),\n annotations: WRITE,\n inputSchema: { id: z.string().describe('Parser ID') },\n },\n async ({ id }) => gqlCall(ctx, 'parser_execute', 'executeParser', EXECUTE_PARSER, { id }),\n );\n}\n","/**\n * BigConsole pipeline tools (BOFF-11426).\n *\n * Surface (7): pipeline_get, pipelines_list, pipeline_create, pipeline_update,\n * pipeline_execute, pipeline_test, pipeline_executions_list.\n *\n * A pipeline chains parsers: each stage reads one data key, runs a stored parser's expression\n * and writes another key. `pipeline_test` runs the stages on the input you give without storing\n * anything, so build and try a pipeline there before `pipeline_execute`.\n *\n * `deletePipeline` is deliberately absent, like every delete in this module.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { errorResult, mcpToolName, type McpContext } from '../../../core/index.js';\nimport {\n CREATE_PIPELINE,\n EXECUTE_PIPELINE,\n GET_PIPELINE,\n LIST_PIPELINE_EXECUTIONS,\n LIST_PIPELINES,\n TEST_PIPELINE,\n UPDATE_PIPELINE,\n} from '../operations.js';\nimport { READ_ONLY, WRITE, definedInput, describeTool, gqlCall } from './call.js';\nimport {\n PageCursor,\n PageSize,\n ParserTypeEnum,\n PipelineStatusEnum,\n VersionInt,\n VERSION_OMITTED_MESSAGE,\n} from './shared.js';\n\nconst StageErrorHandling = z\n .enum(['fail', 'fallback', 'skip'])\n .describe('What a failing stage does: fail the run, use fallbackValue, or skip the stage');\n\nconst StageFields = {\n parserName: z.string().optional().describe('Display name of the parser'),\n parserType: ParserTypeEnum.optional(),\n expression: z.string().optional().describe('Expression override for this stage'),\n enabled: z.boolean().optional().describe('Whether the stage runs (default true)'),\n onError: StageErrorHandling.optional(),\n fallbackValue: z.unknown().optional().describe('Value used when onError is \"fallback\"'),\n description: z.string().optional().describe('What the stage does'),\n};\n\nconst CreateStage = z.object({\n parserId: z.string().describe('Stored parser this stage runs'),\n inputKey: z.string().describe('Data key the stage reads'),\n outputKey: z.string().describe('Data key the stage writes'),\n ...StageFields,\n});\n\nconst UpdateStage = z.object({\n id: z.string().optional().describe('Existing stage ID; omit to add a stage'),\n parserId: z.string().optional().describe('Stored parser this stage runs'),\n inputKey: z.string().optional().describe('Data key the stage reads'),\n outputKey: z.string().optional().describe('Data key the stage writes'),\n ...StageFields,\n});\n\nexport function registerPipelineTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'pipeline_get')),\n {\n title: 'Get Pipeline',\n description: describeTool(\n 'One pipeline with its ordered stages and current version. Read it before ' +\n 'pipeline_update: the update needs the version back unchanged.',\n ),\n annotations: READ_ONLY,\n inputSchema: { id: z.string().describe('Pipeline ID') },\n },\n async ({ id }) => gqlCall(ctx, 'pipeline_get', 'pipeline', GET_PIPELINE, { id }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'pipelines_list')),\n {\n title: 'List Pipelines',\n description: describeTool(\n 'Pipelines in the workspace, metadata only (no stages; use pipeline_get). Filter by ' +\n 'dashboard (consoleId) or status.',\n ),\n annotations: READ_ONLY,\n inputSchema: {\n consoleId: z.string().optional().describe('Only pipelines of this dashboard'),\n status: PipelineStatusEnum.optional(),\n first: PageSize,\n after: PageCursor,\n },\n },\n async ({ consoleId, status, first, after }) => {\n const filter = definedInput({ consoleId, status });\n return gqlCall(ctx, 'pipelines_list', 'listPipelines', LIST_PIPELINES, {\n first: first ?? 20,\n ...definedInput({ after }),\n ...(Object.keys(filter).length > 0 ? { filter } : {}),\n });\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'pipeline_create')),\n {\n title: 'Create Pipeline',\n description: describeTool(\n 'Create a pipeline on a dashboard (consoleId) from ordered stages. Each stage names a ' +\n 'stored parser and the data keys it reads and writes. Try it with pipeline_test before ' +\n 'running it for real.',\n ),\n annotations: WRITE,\n inputSchema: {\n consoleId: z.string().describe('Dashboard ID the pipeline belongs to'),\n name: z.string().describe('Pipeline name'),\n description: z.string().optional().describe('What the pipeline does'),\n status: PipelineStatusEnum.optional(),\n stages: z.array(CreateStage).optional().describe('Stages, in run order'),\n },\n },\n async (args) =>\n gqlCall(ctx, 'pipeline_create', 'createPipeline', CREATE_PIPELINE, {\n input: definedInput(args),\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'pipeline_update')),\n {\n title: 'Update Pipeline',\n description: describeTool(\n 'Update a pipeline with optimistic locking. `version` is REQUIRED — read it from ' +\n 'pipeline_get first and send it back unchanged; a stale version is rejected, so re-read ' +\n 'and retry. A stages list you pass replaces the stored stages.',\n ),\n annotations: WRITE,\n inputSchema: {\n id: z.string().describe('Pipeline ID'),\n version: VersionInt.optional(),\n name: z.string().optional().describe('New name'),\n description: z.string().optional().describe('New description'),\n status: PipelineStatusEnum.optional(),\n stages: z.array(UpdateStage).optional().describe('Replacement stages, in run order'),\n },\n },\n async ({ id, version, ...fields }) => {\n if (version === undefined) return errorResult(VERSION_OMITTED_MESSAGE);\n return gqlCall(ctx, 'pipeline_update', 'updatePipeline', UPDATE_PIPELINE, {\n id,\n version,\n input: definedInput(fields),\n });\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'pipeline_execute')),\n {\n title: 'Execute Pipeline',\n description: describeTool(\n 'Run a stored pipeline now. Its stages write their output keys, replacing what those ' +\n 'keys held, so try the pipeline with pipeline_test first. Returns the execution ' +\n 'record; follow it with pipeline_executions_list.',\n ),\n annotations: WRITE,\n inputSchema: {\n pipelineId: z.string().describe('Pipeline ID'),\n inputData: z.unknown().optional().describe('Input for the first stage'),\n },\n },\n async (args) =>\n gqlCall(ctx, 'pipeline_execute', 'executePipeline', EXECUTE_PIPELINE, {\n input: definedInput(args),\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'pipeline_test')),\n {\n title: 'Test Pipeline',\n description: describeTool(\n 'Run a pipeline in test mode on the inputData you give and return the execution record ' +\n '(status, timing, error). Use it to try a pipeline before pipeline_execute.',\n ),\n annotations: WRITE,\n inputSchema: {\n pipelineId: z.string().describe('Pipeline ID'),\n inputData: z.unknown().describe('Sample input for the first stage'),\n },\n },\n async (args) =>\n gqlCall(ctx, 'pipeline_test', 'testPipeline', TEST_PIPELINE, {\n input: definedInput(args),\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'pipeline_executions_list')),\n {\n title: 'List Pipeline Executions',\n description: describeTool(\n 'The past runs of a pipeline, newest first: status, timing and any error.',\n ),\n annotations: READ_ONLY,\n inputSchema: {\n pipelineId: z.string().describe('Pipeline ID'),\n first: PageSize,\n after: PageCursor,\n },\n },\n async ({ pipelineId, first, after }) =>\n gqlCall(ctx, 'pipeline_executions_list', 'listPipelineExecutions', LIST_PIPELINE_EXECUTIONS, {\n pipelineId,\n first: first ?? 20,\n ...definedInput({ after }),\n }),\n );\n}\n","/**\n * BigConsole prompt-generation tools (BOFF-11426).\n *\n * Surface (5): prompt_generations_list, prompt_generation_get, prompt_generation_cancel,\n * prompt_suggestions, prompt_analyze.\n *\n * `dashboard_generate_from_prompt` (generate.ts) submits a prompt and waits for the result. These\n * tools cover the rest of the lifecycle: find earlier generations, read one, stop one that is\n * still running, and preview or get ideas for a prompt without spending a generation.\n * `deletePromptGeneration` is deliberately absent, like every delete in this module.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpToolName, type McpContext } from '../../../core/index.js';\nimport {\n CANCEL_PROMPT_GENERATION,\n GET_PROMPT_GENERATION,\n GET_PROMPT_SUGGESTIONS,\n LIST_PROMPT_GENERATIONS,\n PREVIEW_PROMPT_ANALYSIS,\n} from '../operations.js';\nimport { READ_ONLY, WRITE, definedInput, describeTool, gqlCall } from './call.js';\nimport { PageCursor, PageSize, PromptGenerationStatusEnum } from './shared.js';\n\nexport function registerPromptTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'prompt_generations_list')),\n {\n title: 'List Prompt Generations',\n description: describeTool(\n 'Earlier AI dashboard generations, newest first, optionally by status: prompt, status, ' +\n 'resulting dashboard and any error.',\n ),\n annotations: READ_ONLY,\n inputSchema: {\n status: PromptGenerationStatusEnum.optional(),\n first: PageSize,\n after: PageCursor,\n },\n },\n async ({ status, first, after }) =>\n gqlCall(ctx, 'prompt_generations_list', 'listPromptGenerations', LIST_PROMPT_GENERATIONS, {\n first: first ?? 20,\n ...definedInput({ status, after }),\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'prompt_generation_get')),\n {\n title: 'Get Prompt Generation',\n description: describeTool(\n 'One AI dashboard generation: status, error, the digest of the generated spec and the ' +\n 'dashboard it produced.',\n ),\n annotations: READ_ONLY,\n inputSchema: { id: z.string().describe('Generation ID') },\n },\n async ({ id }) =>\n gqlCall(ctx, 'prompt_generation_get', 'getPromptGeneration', GET_PROMPT_GENERATION, { id }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'prompt_generation_cancel')),\n {\n title: 'Cancel Prompt Generation',\n description: describeTool(\n 'Stop an AI dashboard generation that is still pending or running. A finished ' +\n 'generation cannot be cancelled.',\n ),\n annotations: WRITE,\n inputSchema: { generationId: z.string().describe('Generation ID') },\n },\n async ({ generationId }) =>\n gqlCall(ctx, 'prompt_generation_cancel', 'cancelPromptGeneration', CANCEL_PROMPT_GENERATION, {\n generationId,\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'prompt_suggestions')),\n {\n title: 'Get Prompt Suggestions',\n description: describeTool(\n 'Example prompts for dashboard generation, filtered by category or search text.',\n ),\n annotations: READ_ONLY,\n inputSchema: {\n category: z.string().optional().describe('Prompt category'),\n search: z.string().optional().describe('Search text'),\n limit: z.number().int().min(1).max(50).default(10).describe('Maximum suggestions'),\n },\n },\n async ({ category, search, limit }) =>\n gqlCall(\n ctx,\n 'prompt_suggestions',\n 'getPromptSuggestions',\n GET_PROMPT_SUGGESTIONS,\n definedInput({ category, search, limit: limit ?? 10 }),\n ),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'prompt_analyze')),\n {\n title: 'Analyze Prompt',\n description: describeTool(\n 'Preview how BigConsole would read a prompt — intent, metrics, data needs, suggested ' +\n 'widgets — without generating anything or using a generation.',\n ),\n annotations: READ_ONLY,\n inputSchema: { prompt: z.string().describe('The dashboard prompt, in plain English') },\n },\n async ({ prompt }) =>\n gqlCall(ctx, 'prompt_analyze', 'previewPromptAnalysis', PREVIEW_PROMPT_ANALYSIS, { prompt }),\n );\n}\n","/**\n * BigConsole widget tool — the rendering layer of the pipeline.\n *\n * Surface (8): widget_create, widget_get, widgets_list, widget_update, widget_duplicate,\n * widget_refresh_data, widget_types, widget_renderers.\n *\n * A widget is a built-in renderer + a rich declarative `config` + a field\n * mapping, bound to a data sink and/or parser, placed on a PAGE (not the\n * dashboard — get the page id from dashboard_get). Step 4 of the pipeline.\n *\n * ### The config is the custom-widget builder\n *\n * There is no code path: `config` is opaque JSON the renderer reads, and the\n * two rules that make a widget render correctly are enforced by the zod\n * shapes in shared.ts, not by documentation:\n *\n * - charts store as one internal renderer — `config.chartType`\n * (\"line\"|\"bar\"|\"area\"|\"pie\") must match the enum type or the widget\n * renders as a line regardless of `type`;\n * - single-KPI cards need `config._internalWidgetType: \"metric_card\"` and\n * retention grids need `\"retention\"` — without them the wrong renderer\n * picks the widget up.\n *\n * Field names in the config must match the keys the parser/sink emits per\n * row: the renderer reads `row[config.valueField]`, `row[config.xAxisField]`,\n * `row[column.key]` — a mismatch renders an empty widget with no error.\n *\n * Only the nine render-verified types are accepted; see shared.ts for why.\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 CREATE_WIDGET,\n DUPLICATE_WIDGET,\n GET_WIDGET,\n GET_WIDGET_RENDERERS,\n GET_WIDGET_TYPES,\n LIST_WIDGETS_BY_DASHBOARD,\n REFRESH_WIDGET_DATA,\n UPDATE_WIDGET,\n} from '../operations.js';\nimport { WidgetConfig, WidgetPosition, WidgetTypeEnum, WORKSPACE_NOTE } from './shared.js';\nimport { READ_ONLY, WRITE, definedInput, describeTool, gqlCall } from './call.js';\n\nexport function registerWidgetTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widget_create')),\n {\n title: 'Create Widget',\n description:\n 'Place a widget on a dashboard page — the last step of the pipeline (DataSink → ' +\n 'Dashboard → Parser → Widget). Bind data with parserId (preferred — the parser output ' +\n 'is already chart-shaped) and/or dataSinkId. Build a rich config for the chosen type ' +\n '(never {}): charts need config.chartType matching the type, single-KPI needs ' +\n 'config._internalWidgetType \"metric_card\", retention needs \"retention\"; field names ' +\n 'must match the parser/sink output keys. ' +\n WORKSPACE_NOTE,\n inputSchema: {\n pageId: z\n .string()\n .describe('Page ID (from dashboard_get — widgets live on pages, not dashboards)'),\n title: z.string().describe('Widget title'),\n type: WidgetTypeEnum,\n config: WidgetConfig,\n position: WidgetPosition,\n parserId: z\n .string()\n .optional()\n .describe('Parser whose output the widget reads (preferred binding)'),\n dataSinkId: z\n .string()\n .optional()\n .describe('Data sink the widget reads (use alone when rows are already chart-shaped)'),\n },\n },\n async ({ pageId, title, type, config, position, parserId, dataSinkId }) => {\n if (!parserId && !dataSinkId) {\n return errorResult(\n 'Bind the widget to data: provide parserId and/or dataSinkId.',\n 'Widgets without a binding render empty. Prefer parserId so the data is already ' +\n 'shaped for the renderer.',\n );\n }\n try {\n const result = await ctx.gql.workspace.request<{\n createBigConsoleWidget: Record<string, unknown>;\n }>(CREATE_WIDGET, {\n input: {\n pageId,\n title,\n type,\n config,\n position,\n ...(parserId !== undefined ? { parserId } : {}),\n ...(dataSinkId !== undefined ? { dataSinkId } : {}),\n },\n });\n return jsonResult(result.createBigConsoleWidget);\n } catch (error) {\n ctx.logger.error('bigconsole widget_create failed', { error: String(error) });\n return errorResult(\n `Failed to create the widget: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widget_get')),\n {\n title: 'Get Widget',\n description: describeTool(\n 'One widget with its full config. This is the only read that returns a widget config; ' +\n 'read it before widget_update so you change the config rather than replace it blind.',\n ),\n annotations: READ_ONLY,\n inputSchema: { id: z.string().describe('Widget ID') },\n },\n async ({ id }) => gqlCall(ctx, 'widget_get', 'getWidget', GET_WIDGET, { id }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widgets_list')),\n {\n title: 'List Widgets',\n description: describeTool(\n 'The widgets of one dashboard — id, page, type, title, renderer, position and bindings, ' +\n 'never the config (use widget_get for that). Optionally filter by widget type.',\n ),\n annotations: READ_ONLY,\n inputSchema: {\n dashboardId: z.string().describe('Dashboard ID'),\n type: WidgetTypeEnum.optional(),\n },\n },\n async ({ dashboardId, type }) =>\n gqlCall(\n ctx,\n 'widgets_list',\n 'listWidgetsByDashboard',\n LIST_WIDGETS_BY_DASHBOARD,\n definedInput({ dashboardId, type }),\n ),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widget_update')),\n {\n title: 'Update Widget',\n description: describeTool(\n \"Change a widget's title, config, position or data binding. Only the fields you pass \" +\n 'change. A config you pass replaces the stored one, so start from widget_get. The same ' +\n 'config rules as widget_create apply.',\n ),\n annotations: WRITE,\n inputSchema: {\n id: z.string().describe('Widget ID'),\n title: z.string().optional().describe('New title'),\n config: WidgetConfig.optional(),\n position: WidgetPosition.optional(),\n parserId: z.string().optional().describe('Parser whose output the widget reads'),\n dataSinkId: z.string().optional().describe('Data sink the widget reads'),\n refreshInterval: z.number().int().min(0).optional().describe('Auto-refresh seconds'),\n },\n },\n async (args) =>\n gqlCall(ctx, 'widget_update', 'updateBigConsoleWidget', UPDATE_WIDGET, {\n input: definedInput(args),\n }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widget_duplicate')),\n {\n title: 'Duplicate Widget',\n description: describeTool(\n 'Copy a widget, optionally to a new grid position and under a new title.',\n ),\n annotations: WRITE,\n inputSchema: {\n id: z.string().describe('Widget to copy'),\n newPosition: WidgetPosition.optional(),\n newTitle: z.string().optional().describe('Title of the copy'),\n },\n },\n async ({ id, newPosition, newTitle }) =>\n gqlCall(\n ctx,\n 'widget_duplicate',\n 'duplicateWidget',\n DUPLICATE_WIDGET,\n definedInput({ id, newPosition, newTitle }),\n ),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widget_refresh_data')),\n {\n title: 'Refresh Widget Data',\n description: describeTool(\n 'Re-fetch the data behind a widget so the next render is current. Returns when it was fetched, not the data.',\n ),\n annotations: WRITE,\n inputSchema: { widgetId: z.string().describe('Widget ID') },\n },\n async ({ widgetId }) =>\n gqlCall(ctx, 'widget_refresh_data', 'refreshWidgetData', REFRESH_WIDGET_DATA, { widgetId }),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widget_types')),\n {\n title: 'List Widget Types',\n description: describeTool(\n 'Every widget type BigConsole knows, with its default config and size. widget_create ' +\n 'accepts only the nine render-verified ones; this lists the rest for reference.',\n ),\n annotations: READ_ONLY,\n inputSchema: {},\n },\n async () => gqlCall(ctx, 'widget_types', 'getWidgetTypes', GET_WIDGET_TYPES, {}),\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'widget_renderers')),\n {\n title: 'List Widget Renderers',\n description: describeTool(\n 'The widget renderers available and the widget types each supports.',\n ),\n annotations: READ_ONLY,\n inputSchema: {},\n },\n async () => gqlCall(ctx, 'widget_renderers', 'getAvailableRenderers', GET_WIDGET_RENDERERS, {}),\n );\n}\n","/**\n * BigConsole module — console authoring for external agents (BOFF-3729).\n *\n * Backend subgraph: ~/products/wspace/bigconsole/wspace-bigconsole-svc/\n * (Hive service name `bigconsole`). Runs against the WORKSPACE PUBLIC gateway,\n * which is where `@rbac` is enforced from the composed supergraph. This module\n * authorises nothing itself and never touches a token — `ctx.gql.workspace`\n * injects the session credential (app-client-credentials or device-code login)\n * and the `x-workspace-id` header chosen via `auth_select_workspace`.\n *\n * ### The least-privilege surface (AI_READINESS §2.2)\n *\n * Sixteen tools covering exactly the console-authoring pipeline and nothing\n * else (the first tranche, BOFF-3729):\n *\n * - DataSinks: list / get / create / update (4)\n * - Dashboards + pages: list / get / create / page-create (4)\n * - Parsers: list / create / update / test-expression (4)\n * - Widgets: create (1)\n * - Console Definition JSON: export / import (2) — the headline round-trip\n * - Generate-from-prompt: submit + poll + optional materialize (1)\n *\n * A second tranche (BOFF-11426, 33 tools) adds the rest of what the SDK offers that is not on the\n * absent list below: dashboard update/clone/search; widget get/list/update/duplicate/refresh/types/\n * renderers; data sink refresh and cache invalidation; parser get/execute; the pipeline tools (7);\n * the BigConsole workflow tools (7, named `linked_workflow*`); and prompt-generation list/get/cancel/\n * suggestions/analyze. No tool returns sink rows or parser output.\n *\n * Deliberately absent: every `delete_*` / `archive_*` / `publish` /\n * share / RLS / embed / template-store mutation. Read + create (+ the two\n * sanctioned updates, both version-locked) is the valuable 90%, and an\n * external agent that cannot archive a production console is the security\n * posture the readiness audit asks for (§2.2/§2.3).\n *\n * ### The recipe is the contract\n *\n * Tool shapes mirror `ai-assistant/context/api-calls/products/bigconsole.md`\n * (the authoritative build recipe): the forced DataSink → Dashboard → Parser\n * → Widget order falls out of the argument shapes (`consoleId` = dashboard\n * id, widgets bound by pageId / parserId / dataSinkId), and the two footguns\n * are tool-level zod constraints in tools/shared.ts, not documentation.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerDashboardTools } from './tools/dashboards.js';\nimport { registerDataSinkTools } from './tools/datasinks.js';\nimport { registerGenerateTools } from './tools/generate.js';\nimport { registerLinkedWorkflowTools } from './tools/linked-workflows.js';\nimport { registerParserTools } from './tools/parsers.js';\nimport { registerPipelineTools } from './tools/pipelines.js';\nimport { registerPromptTools } from './tools/prompts.js';\nimport { registerWidgetTools } from './tools/widgets.js';\n\nconst bigconsoleModule: McpModule = {\n id: 'bigconsole',\n version: '0.0.1',\n displayName: 'BigConsole',\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 registerDataSinkTools(server, ctx, track);\n registerDashboardTools(server, ctx, track);\n registerParserTools(server, ctx, track);\n registerWidgetTools(server, ctx, track);\n registerGenerateTools(server, ctx, track);\n registerPipelineTools(server, ctx, track);\n registerLinkedWorkflowTools(server, ctx, track);\n registerPromptTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default bigconsoleModule;\n"]}