farseer-cli 1.14.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/config.js +4 -3
- package/dist/commands/config.js.map +2 -2
- package/dist/commands/install.js +5 -0
- package/dist/commands/install.js.map +2 -2
- package/dist/commands/login.js +2 -2
- package/dist/commands/login.js.map +2 -2
- package/dist/commands/pull.js +9 -3
- package/dist/commands/pull.js.map +2 -2
- package/dist/commands/run.js +9 -0
- package/dist/commands/run.js.map +2 -2
- package/dist/index.js +7 -2
- package/dist/index.js.map +2 -2
- package/dist/mcp/tools/appTools.js.map +2 -2
- package/dist/mcp/tools/authTools.js +5 -3
- package/dist/mcp/tools/authTools.js.map +2 -2
- package/dist/mcp/tools/cellTools.js +3 -2
- package/dist/mcp/tools/cellTools.js.map +2 -2
- package/dist/mcp/tools/dashboardTools.js +23 -18
- package/dist/mcp/tools/dashboardTools.js.map +2 -2
- package/dist/mcp/tools/dataTools.js +13 -11
- package/dist/mcp/tools/dataTools.js.map +2 -2
- package/dist/mcp/tools/folderTools.js +5 -4
- package/dist/mcp/tools/folderTools.js.map +2 -2
- package/dist/mcp/tools/modelTools.js +27 -17
- package/dist/mcp/tools/modelTools.js.map +2 -2
- package/dist/mcp/tools/pipelineContract.js +5 -2
- package/dist/mcp/tools/pipelineContract.js.map +2 -2
- package/dist/mcp/tools/runTools.js +8 -3
- package/dist/mcp/tools/runTools.js.map +2 -2
- package/dist/mcp/tools/sheetTools.js +21 -17
- package/dist/mcp/tools/sheetTools.js.map +2 -2
- package/dist/mcp/tools/syncTools.js +11 -5
- package/dist/mcp/tools/syncTools.js.map +2 -2
- package/dist/mcp/utils/registerTool.js +32 -0
- package/dist/mcp/utils/registerTool.js.map +7 -0
- package/dist/pipeline/generated-reference.json +3 -3
- package/dist/pipeline/operations.js +4 -1
- package/dist/pipeline/operations.js.map +2 -2
- package/dist/pipeline/query.js +58 -40
- package/dist/pipeline/query.js.map +2 -2
- package/dist/pipeline/queryDownloads.js +72 -0
- package/dist/pipeline/queryDownloads.js.map +7 -0
- package/dist/pipeline/queryWorker.js +8 -31
- package/dist/pipeline/queryWorker.js.map +2 -2
- package/dist/pipeline/readiness.js +15 -8
- package/dist/pipeline/readiness.js.map +2 -2
- package/dist/pipeline/reference.js +2 -1
- package/dist/pipeline/reference.js.map +2 -2
- package/dist/pipeline/runtime.js +4 -3
- package/dist/pipeline/runtime.js.map +2 -2
- package/dist/pipeline/service.js +110 -50
- package/dist/pipeline/service.js.map +2 -2
- package/dist/services/appSyncService.js.map +1 -1
- package/dist/services/configService.js +11 -4
- package/dist/services/configService.js.map +2 -2
- package/dist/services/farseerService.js +23 -0
- package/dist/services/farseerService.js.map +2 -2
- package/dist/services/modelExport.js.map +1 -1
- package/dist/utils/agentSandbox.js +35 -0
- package/dist/utils/agentSandbox.js.map +7 -0
- package/dist/utils/constants.js +4 -7
- package/dist/utils/constants.js.map +2 -2
- package/dist/utils/packageManager.js +40 -11
- package/dist/utils/packageManager.js.map +2 -2
- package/dist/utils/updateCheck.js +4 -2
- package/dist/utils/updateCheck.js.map +2 -2
- package/docs/pipeline-client-guide.md +4 -4
- package/package.json +2 -2
- package/skills/pipeline-authoring/SKILL.md +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/mcp/tools/dataTools.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Data Operation Tools\n *\n * MCP tools for data export, import jobs, and file management on Farseer instances.\n * These use the native farseer-client for full API access.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport * as farseer from 'farseer-client';\nimport { requireSession } from '../utils/session';\nimport { successResponse, errorResponse } from '../utils/helpers';\nimport { formatClientError } from '../../utils/errorFormatter';\n\n// Define schemas outside of tool registration to avoid deep type instantiation\nconst exportVariableDataSchema = {\n variableName: z.string().describe('Name of the variable to export'),\n filters: z\n .array(z.array(z.string()).length(2))\n .optional()\n .describe(\n 'Dimension filters as [tableName, memberName] pairs (e.g., [[\"Months\",\"M1\"],[\"Brand\",\"0000032\"]]). Filters the export to specific dimension members.',\n ),\n format: z.enum(['csv', 'json']).optional().describe('Output format (default: csv)'),\n limit: z.number().optional().describe('Maximum number of rows to return'),\n};\n\nconst loadVariableDataSchema = {\n variableName: z.string().describe('Name of the variable to load'),\n dimensions: z.array(z.string()).optional().describe('Dimension table names to include as columns in the export'),\n};\n\nconst createImportJobSchema = {\n title: z.string().describe('Import job title (shown in import history)'),\n columns: z\n .array(\n z.object({\n type: z.enum(['DIMENSION_TABLE', 'VARIABLE', 'DATE', 'DESCRIPTION']).describe('Column type'),\n dimensionTableName: z.string().optional().describe('For DIMENSION_TABLE: name of the dimension table'),\n variableName: z.string().optional().describe('For VARIABLE: name of the variable'),\n columnName: z.string().optional().describe('Column header name'),\n dateFormat: z.string().optional().describe('For DATE: date format string'),\n dimensionsNames: z\n .array(\n z.object({\n tableName: z.string(),\n memberName: z.string(),\n }),\n )\n .optional()\n .describe('For VARIABLE: fixed dimension members (filters) for this variable column'),\n }),\n )\n .describe('Column definitions matching the data structure'),\n rows: z\n .array(z.array(z.union([z.string(), z.number(), z.null()])))\n .describe('Data rows - each row is an array of values matching column order'),\n labels: z\n .array(z.string())\n .optional()\n .describe('Labels for grouping import jobs (used by undoPrevious to revert jobs with same labels)'),\n undoPrevious: z\n .boolean()\n .optional()\n .describe('Revert previous import jobs with the same labels before committing (default: false)'),\n importDimensions: z\n .boolean()\n .optional()\n .describe('Auto-create any missing dimension members before committing (default: false)'),\n overwriteCells: z\n .boolean()\n .optional()\n .describe('Overwrite existing cell values (default: false - adds to existing values)'),\n};\n\nconst createFileSchema = {\n fileName: z.string().describe('Name of the file to create or update'),\n folderPath: z\n .array(z.string())\n .optional()\n .describe('Folder path as array (e.g., [\"Files\", \"Reports\"]). Default: [\"Files\"]'),\n content: z.string().describe('File content as text string'),\n};\n\nexport function registerDataTools(server: McpServer): void {\n // farseer_export_variable_data - Export variable data\n server.tool(\n 'farseer_export_variable_data',\n `Export data from a Farseer variable as CSV.\n\nBuilds an export configuration from the variable's dimensions and uses\nthe evaluator export endpoint. Works on all server versions.\n\nFor small results (under 500 rows), returns data inline.\nFor large results (500+ rows), automatically exports to a temp file and returns the path \u2014\nuse the Read tool to inspect the file contents.\n\nUse the 'limit' parameter to restrict row count for large variables.`,\n exportVariableDataSchema,\n // @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas\n async (params: {\n variableName: string;\n filters?: Array<Array<string>>;\n format?: 'csv' | 'json';\n limit?: number;\n }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, native: nativeClient } = gate.session;\n\n try {\n const text = await exportVariableAsCsv(nativeClient, params.variableName, params.limit, params.filters);\n\n const lines = text.split('\\n').filter((l) => l.trim());\n const rowCount = Math.max(0, lines.length - 1);\n\n const CSV_THRESHOLD = 500;\n\n // Large result \u2014 export to file\n if (rowCount >= CSV_THRESHOLD) {\n const tmpDir = os.tmpdir();\n const safeName = params.variableName.replace(/[^a-zA-Z0-9_-]/g, '_');\n const filePath = path.join(tmpDir, `farseer_${tenant}_${safeName}.csv`);\n fs.writeFileSync(filePath, text, 'utf-8');\n\n const previewLines = lines.slice(0, 6).join('\\n');\n\n return successResponse({\n tenant,\n variable: params.variableName,\n format: 'csv',\n rowCount,\n exportedToFile: filePath,\n message: `Variable has ${rowCount} rows \u2014 exported to file. Use Read tool to inspect.`,\n preview: previewLines,\n });\n }\n\n return successResponse({\n tenant,\n variable: params.variableName,\n format: 'csv',\n rowCount,\n data: text,\n });\n } catch (error) {\n return errorResponse(`Export variable data failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_load_variable_data - Load variable data with specific dimensions\n server.tool(\n 'farseer_load_variable_data',\n `Load data from a Farseer variable into a structured CSV format.\n\nExports all data cells for the variable. You can optionally filter to\nspecific dimensions only.\n\nFor small results (under 500 rows), returns data inline.\nFor large results (500+ rows), automatically exports to a temp CSV file and returns the path.\n\nExample usage:\n- Load \"Revenue\" data (all dimensions)\n- Load \"Revenue\" with dimensions [\"Product\", \"Years\", \"Months\"]`,\n loadVariableDataSchema,\n // @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas\n async (params: { variableName: string; dimensions?: string[] }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, native: nativeClient } = gate.session;\n\n try {\n const text = await exportVariableAsCsv(nativeClient, params.variableName);\n\n const lines = text.split('\\n').filter((l) => l.trim());\n const rowCount = Math.max(0, lines.length - 1);\n\n const CSV_THRESHOLD = 500;\n\n // Large result \u2014 export to file\n if (rowCount >= CSV_THRESHOLD) {\n const tmpDir = os.tmpdir();\n const safeName = params.variableName.replace(/[^a-zA-Z0-9_-]/g, '_');\n const filePath = path.join(tmpDir, `farseer_${tenant}_${safeName}_data.csv`);\n fs.writeFileSync(filePath, text, 'utf-8');\n\n const previewLines = lines.slice(0, 6).join('\\n');\n\n return successResponse({\n tenant,\n variable: params.variableName,\n dimensions: params.dimensions || 'all',\n rowCount,\n exportedToFile: filePath,\n message: `Variable has ${rowCount} rows \u2014 exported to CSV. Use Read tool to inspect.`,\n preview: previewLines,\n });\n }\n\n return successResponse({\n tenant,\n variable: params.variableName,\n dimensions: params.dimensions || 'all',\n rowCount,\n data: text,\n });\n } catch (error) {\n return errorResponse(`Load variable data failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_create_import_job - Create and execute import job\n server.tool(\n 'farseer_create_import_job',\n `Create and execute a complete data import job on a Farseer instance.\n\nFor repeatable data extraction, transformation and loading, start with farseer_pipeline operation=guide topic=method. Use this tool for a direct import the user requested. If pipeline setup is missing, explain what needs preparing before choosing a different workflow.\n\nThis tool handles the full import workflow in a single call:\n1. Builds import metadata from column definitions\n2. Creates the import job\n3. Adds all data rows\n4. Optionally creates missing dimension members (importDimensions)\n5. Optionally reverts previous imports with same labels (undoPrevious)\n6. Commits the import\n\nColumn types:\n- DIMENSION_TABLE: Maps to a dimension table (e.g., Product, Years, Months)\n- VARIABLE: Maps to a variable that will receive data values\n - Can include dimensionsNames to fix specific dimension members for this column\n- DATE: Date column with format string\n- DESCRIPTION: Cell description/comment\n\nThe 'labels' parameter is important for the undoPrevious feature:\nwhen undoPrevious is true, all previously committed imports with the\nsame labels will be reverted before this import is committed.\nThis is useful for idempotent re-imports.\n\nThe 'overwriteCells' parameter controls whether existing values are\noverwritten (true) or accumulated (false, default).\n\nExample columns for importing revenue data:\n[\n { \"type\": \"DIMENSION_TABLE\", \"dimensionTableName\": \"Product\" },\n { \"type\": \"DIMENSION_TABLE\", \"dimensionTableName\": \"Years\" },\n { \"type\": \"DIMENSION_TABLE\", \"dimensionTableName\": \"Months\" },\n { \"type\": \"VARIABLE\", \"variableName\": \"Revenue\",\n \"dimensionsNames\": [\n { \"tableName\": \"Versions\", \"memberName\": \"Actual\" }\n ]\n }\n]`,\n createImportJobSchema,\n // @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas\n async (params: {\n title: string;\n columns: Array<{\n type: 'DIMENSION_TABLE' | 'VARIABLE' | 'DATE' | 'DESCRIPTION';\n dimensionTableName?: string;\n variableName?: string;\n columnName?: string;\n dateFormat?: string;\n dimensionsNames?: Array<{ tableName: string; memberName: string }>;\n }>;\n rows: Array<Array<string | number | null>>;\n labels?: string[];\n undoPrevious?: boolean;\n importDimensions?: boolean;\n overwriteCells?: boolean;\n }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, native: nativeClient } = gate.session;\n\n try {\n await nativeClient.initTagMap();\n\n const {\n title,\n columns,\n rows,\n labels,\n undoPrevious = false,\n importDimensions = false,\n overwriteCells = false,\n } = params;\n\n // Build metadata columns\n const metadataColumns = columns.map((col) => {\n switch (col.type) {\n case 'DIMENSION_TABLE':\n return {\n type: 'DIMENSION_TABLE' as const,\n dimensionTableName: col.dimensionTableName!,\n columnName: col.columnName,\n };\n case 'VARIABLE':\n return {\n type: 'VARIABLE' as const,\n variableName: col.variableName!,\n columnName: col.columnName || col.variableName!,\n dimensionsNames: col.dimensionsNames,\n };\n case 'DATE':\n return {\n type: 'DATE' as const,\n dateFormat: col.dateFormat!,\n columnName: col.columnName,\n };\n case 'DESCRIPTION':\n return {\n type: 'DESCRIPTION' as const,\n columnName: col.columnName,\n };\n default:\n return {\n type: 'NONE' as const,\n columnName: col.columnName,\n };\n }\n });\n\n // Build metadata\n const metadata = await nativeClient.buildImportJobMetadata(metadataColumns as any);\n\n if (overwriteCells) {\n (metadata as any).overwriteCells = true;\n }\n\n // Create import job\n const importActions = await nativeClient.createImportJob({\n title,\n metadata,\n labels,\n });\n\n // Add rows\n await importActions.addRows(rows as any);\n await importActions.flushRows();\n\n // Import dimensions if needed\n if (importDimensions) {\n await importActions.importDimensions();\n }\n\n // Undo previous if needed\n if (undoPrevious) {\n await importActions.undoPrevious();\n }\n\n // Commit\n const report = await importActions.commit();\n\n return successResponse({\n tenant,\n title,\n rowCount: rows.length,\n labels: labels || [],\n undoPrevious,\n importDimensions,\n overwriteCells,\n commitReport: report,\n });\n } catch (error) {\n return errorResponse(`Import job failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_create_file - Create or update file on instance\n server.tool(\n 'farseer_create_file',\n `Create or update a file on a Farseer instance.\n\nThis creates a file in the specified folder on the Farseer file system.\nIf a file with the same name already exists in that folder, it will be updated.\n\nThe folderPath is an array of folder names, starting from the root.\nDefault is [\"Files\"] which is the standard files folder.\n\nCommon use cases:\n- Creating CSV report files\n- Uploading configuration files\n- Saving processed data outputs`,\n createFileSchema,\n async (params: { fileName: string; folderPath?: string[]; content: string }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, client, native: nativeClient } = gate.session;\n\n try {\n const folderPath = params.folderPath || ['Files'];\n // Not nativeClient.getItemByPath: for a single-segment path that\n // name-searches the whole tenant and refuses on more than one\n // loose match, so a second folder called \"Files\" breaks it.\n const folder = await client.getFolderByPath(folderPath);\n if (!folder) {\n return errorResponse(`Folder \"${folderPath.join('/')}\" not found`, 'NOT_FOUND');\n }\n const buffer = Buffer.from(params.content, 'utf-8');\n\n await nativeClient.createOrUpdateFarseerFile(\n { name: params.fileName, folderId: folder.id } as any,\n buffer,\n );\n\n return successResponse({\n tenant,\n fileName: params.fileName,\n folderPath,\n size: buffer.length,\n message: `File \"${params.fileName}\" created/updated in ${folderPath.join('/')}`,\n });\n } catch (error) {\n return errorResponse(`Create file failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n}\n\n/**\n * Export variable data as CSV using evaluatorExport (works on all server versions).\n * Falls back to exportFormula if evaluatorExport fails.\n */\n/**\n * Export variable data as CSV using exportFormula.\n * Wraps the variable name in quotes as required by the API.\n * Supports dimension filters: [[\"Months\",\"M1\"],[\"Brand\",\"0000032\"]]\n * becomes sum(\"VarName\", \"Months\">\"M1\", \"Brand\">\"0000032\")\n */\nasync function exportVariableAsCsv(\n client: farseer.FarseerClient,\n variableName: string,\n limit?: number,\n filters?: Array<Array<string>>,\n): Promise<string> {\n let formula: string;\n if (filters && filters.length > 0) {\n const filterParts = filters.map(([table, member]) => `\"${table}\">\"${member}\"`).join(', ');\n formula = `sum(\"${variableName}\", ${filterParts})`;\n } else {\n formula = `\"${variableName}\"`;\n }\n\n const blob = await client.export.exportFormula({\n formula,\n format: farseer.ExportFormat.Csv,\n limit,\n });\n return await blob.text();\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,iBAAkB;AAClB,SAAoB;AACpB,WAAsB;AACtB,SAAoB;AACpB,cAAyB;AACzB,qBAA+B;AAC/B,qBAA+C;AAC/C,4BAAkC;AAGlC,MAAM,2BAA2B;AAAA,EAC7B,cAAc,aAAE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AO,GAAG,aAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAC1D,SAAS,kEAAkE;AAAA,EAChF,QAAQ,aACH,MAAM,aAAE,OAAO,CAAC,EAChB,SAAS,EACT,SAAS,wFAAwF;AAAA,EACtG,cAAc,aACT,QAAQ,EACR,SAAS,EACT,SAAS,qFAAqF;AAAA,EACnG,kBAAkB,aACb,QAAQ,EACR,SAAS,EACT,SAAS,8EAA8E;AAAA,EAC5F,gBAAgB,aACX,QAAQ,EACR,SAAS,EACT,SAAS,2EAA2E;AAC7F;AAEA,MAAM,mBAAmB;AAAA,EACrB,UAAU,aAAE,OAAO,EAAE,SAAS,sCAAsC;AAAA,EACpE,YAAY,aACP,MAAM,aAAE,OAAO,CAAC,EAChB,SAAS,EACT,SAAS,uEAAuE;AAAA,EACrF,SAAS,aAAE,OAAO,EAAE,SAAS,6BAA6B;AAC9D;AAEO,SAAS,kBAAkB,QAAyB;AAEvD,
|
|
4
|
+
"sourcesContent": ["/**\n * Data Operation Tools\n *\n * MCP tools for data export, import jobs, and file management on Farseer instances.\n * These use the native farseer-client for full API access.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { registerTool } from '../utils/registerTool';\nimport { z } from 'zod';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport * as farseer from 'farseer-client';\nimport { requireSession } from '../utils/session';\nimport { successResponse, errorResponse } from '../utils/helpers';\nimport { formatClientError } from '../../utils/errorFormatter';\n\n// Define schemas outside of tool registration to avoid deep type instantiation\nconst exportVariableDataSchema = {\n variableName: z.string().describe('Name of the variable to export'),\n filters: z\n .array(z.array(z.string()).length(2))\n .optional()\n .describe(\n 'Dimension filters as [tableName, memberName] pairs (e.g., [[\"Months\",\"M1\"],[\"Brand\",\"0000032\"]]). Filters the export to specific dimension members.',\n ),\n format: z.enum(['csv', 'json']).optional().describe('Output format (default: csv)'),\n limit: z.number().optional().describe('Maximum number of rows to return'),\n};\n\nconst loadVariableDataSchema = {\n variableName: z.string().describe('Name of the variable to load'),\n dimensions: z.array(z.string()).optional().describe('Dimension table names to include as columns in the export'),\n};\n\nconst createImportJobSchema = {\n title: z.string().describe('Import job title (shown in import history)'),\n columns: z\n .array(\n z.object({\n type: z.enum(['DIMENSION_TABLE', 'VARIABLE', 'DATE', 'DESCRIPTION']).describe('Column type'),\n dimensionTableName: z.string().optional().describe('For DIMENSION_TABLE: name of the dimension table'),\n variableName: z.string().optional().describe('For VARIABLE: name of the variable'),\n columnName: z.string().optional().describe('Column header name'),\n dateFormat: z.string().optional().describe('For DATE: date format string'),\n dimensionsNames: z\n .array(\n z.object({\n tableName: z.string(),\n memberName: z.string(),\n }),\n )\n .optional()\n .describe('For VARIABLE: fixed dimension members (filters) for this variable column'),\n }),\n )\n .describe('Column definitions matching the data structure'),\n rows: z\n .array(z.array(z.union([z.string(), z.number(), z.null()])))\n .describe('Data rows - each row is an array of values matching column order'),\n labels: z\n .array(z.string())\n .optional()\n .describe('Labels for grouping import jobs (used by undoPrevious to revert jobs with same labels)'),\n undoPrevious: z\n .boolean()\n .optional()\n .describe('Revert previous import jobs with the same labels before committing (default: false)'),\n importDimensions: z\n .boolean()\n .optional()\n .describe('Auto-create any missing dimension members before committing (default: false)'),\n overwriteCells: z\n .boolean()\n .optional()\n .describe('Overwrite existing cell values (default: false - adds to existing values)'),\n};\n\nconst createFileSchema = {\n fileName: z.string().describe('Name of the file to create or update'),\n folderPath: z\n .array(z.string())\n .optional()\n .describe('Folder path as array (e.g., [\"Files\", \"Reports\"]). Default: [\"Files\"]'),\n content: z.string().describe('File content as text string'),\n};\n\nexport function registerDataTools(server: McpServer): void {\n // farseer_export_variable_data - Export variable data\n registerTool(\n server,\n 'farseer_export_variable_data',\n `Export data from a Farseer variable as CSV.\n\nBuilds an export configuration from the variable's dimensions and uses\nthe evaluator export endpoint. Works on all server versions.\n\nFor small results (under 500 rows), returns data inline.\nFor large results (500+ rows), automatically exports to a temp file and returns the path \u2014\nuse the Read tool to inspect the file contents.\n\nUse the 'limit' parameter to restrict row count for large variables.`,\n exportVariableDataSchema,\n async (params: {\n variableName: string;\n filters?: Array<Array<string>>;\n format?: 'csv' | 'json';\n limit?: number;\n }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, native: nativeClient } = gate.session;\n\n try {\n const text = await exportVariableAsCsv(nativeClient, params.variableName, params.limit, params.filters);\n\n const lines = text.split('\\n').filter((l) => l.trim());\n const rowCount = Math.max(0, lines.length - 1);\n\n const CSV_THRESHOLD = 500;\n\n // Large result \u2014 export to file\n if (rowCount >= CSV_THRESHOLD) {\n const tmpDir = os.tmpdir();\n const safeName = params.variableName.replace(/[^a-zA-Z0-9_-]/g, '_');\n const filePath = path.join(tmpDir, `farseer_${tenant}_${safeName}.csv`);\n fs.writeFileSync(filePath, text, 'utf-8');\n\n const previewLines = lines.slice(0, 6).join('\\n');\n\n return successResponse({\n tenant,\n variable: params.variableName,\n format: 'csv',\n rowCount,\n exportedToFile: filePath,\n message: `Variable has ${rowCount} rows \u2014 exported to file. Use Read tool to inspect.`,\n preview: previewLines,\n });\n }\n\n return successResponse({\n tenant,\n variable: params.variableName,\n format: 'csv',\n rowCount,\n data: text,\n });\n } catch (error) {\n return errorResponse(`Export variable data failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_load_variable_data - Load variable data with specific dimensions\n registerTool(\n server,\n 'farseer_load_variable_data',\n `Load data from a Farseer variable into a structured CSV format.\n\nExports all data cells for the variable. You can optionally filter to\nspecific dimensions only.\n\nFor small results (under 500 rows), returns data inline.\nFor large results (500+ rows), automatically exports to a temp CSV file and returns the path.\n\nExample usage:\n- Load \"Revenue\" data (all dimensions)\n- Load \"Revenue\" with dimensions [\"Product\", \"Years\", \"Months\"]`,\n loadVariableDataSchema,\n async (params: { variableName: string; dimensions?: string[] }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, native: nativeClient } = gate.session;\n\n try {\n const text = await exportVariableAsCsv(nativeClient, params.variableName);\n\n const lines = text.split('\\n').filter((l) => l.trim());\n const rowCount = Math.max(0, lines.length - 1);\n\n const CSV_THRESHOLD = 500;\n\n // Large result \u2014 export to file\n if (rowCount >= CSV_THRESHOLD) {\n const tmpDir = os.tmpdir();\n const safeName = params.variableName.replace(/[^a-zA-Z0-9_-]/g, '_');\n const filePath = path.join(tmpDir, `farseer_${tenant}_${safeName}_data.csv`);\n fs.writeFileSync(filePath, text, 'utf-8');\n\n const previewLines = lines.slice(0, 6).join('\\n');\n\n return successResponse({\n tenant,\n variable: params.variableName,\n dimensions: params.dimensions || 'all',\n rowCount,\n exportedToFile: filePath,\n message: `Variable has ${rowCount} rows \u2014 exported to CSV. Use Read tool to inspect.`,\n preview: previewLines,\n });\n }\n\n return successResponse({\n tenant,\n variable: params.variableName,\n dimensions: params.dimensions || 'all',\n rowCount,\n data: text,\n });\n } catch (error) {\n return errorResponse(`Load variable data failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_create_import_job - Create and execute import job\n registerTool(\n server,\n 'farseer_create_import_job',\n `Create and execute a complete data import job on a Farseer instance.\n\nFor repeatable data extraction, transformation and loading, start with farseer_pipeline operation=guide topic=method. Use this tool for a direct import the user requested. If pipeline setup is missing, explain what needs preparing before choosing a different workflow.\n\nThis tool handles the full import workflow in a single call:\n1. Builds import metadata from column definitions\n2. Creates the import job\n3. Adds all data rows\n4. Optionally creates missing dimension members (importDimensions)\n5. Optionally reverts previous imports with same labels (undoPrevious)\n6. Commits the import\n\nColumn types:\n- DIMENSION_TABLE: Maps to a dimension table (e.g., Product, Years, Months)\n- VARIABLE: Maps to a variable that will receive data values\n - Can include dimensionsNames to fix specific dimension members for this column\n- DATE: Date column with format string\n- DESCRIPTION: Cell description/comment\n\nThe 'labels' parameter is important for the undoPrevious feature:\nwhen undoPrevious is true, all previously committed imports with the\nsame labels will be reverted before this import is committed.\nThis is useful for idempotent re-imports.\n\nThe 'overwriteCells' parameter controls whether existing values are\noverwritten (true) or accumulated (false, default).\n\nExample columns for importing revenue data:\n[\n { \"type\": \"DIMENSION_TABLE\", \"dimensionTableName\": \"Product\" },\n { \"type\": \"DIMENSION_TABLE\", \"dimensionTableName\": \"Years\" },\n { \"type\": \"DIMENSION_TABLE\", \"dimensionTableName\": \"Months\" },\n { \"type\": \"VARIABLE\", \"variableName\": \"Revenue\",\n \"dimensionsNames\": [\n { \"tableName\": \"Versions\", \"memberName\": \"Actual\" }\n ]\n }\n]`,\n createImportJobSchema,\n async (params: {\n title: string;\n columns: Array<{\n type: 'DIMENSION_TABLE' | 'VARIABLE' | 'DATE' | 'DESCRIPTION';\n dimensionTableName?: string;\n variableName?: string;\n columnName?: string;\n dateFormat?: string;\n dimensionsNames?: Array<{ tableName: string; memberName: string }>;\n }>;\n rows: Array<Array<string | number | null>>;\n labels?: string[];\n undoPrevious?: boolean;\n importDimensions?: boolean;\n overwriteCells?: boolean;\n }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, native: nativeClient } = gate.session;\n\n try {\n await nativeClient.initTagMap();\n\n const {\n title,\n columns,\n rows,\n labels,\n undoPrevious = false,\n importDimensions = false,\n overwriteCells = false,\n } = params;\n\n // Build metadata columns\n const metadataColumns = columns.map((col) => {\n switch (col.type) {\n case 'DIMENSION_TABLE':\n return {\n type: 'DIMENSION_TABLE' as const,\n dimensionTableName: col.dimensionTableName!,\n columnName: col.columnName,\n };\n case 'VARIABLE':\n return {\n type: 'VARIABLE' as const,\n variableName: col.variableName!,\n columnName: col.columnName || col.variableName!,\n dimensionsNames: col.dimensionsNames,\n };\n case 'DATE':\n return {\n type: 'DATE' as const,\n dateFormat: col.dateFormat!,\n columnName: col.columnName,\n };\n case 'DESCRIPTION':\n return {\n type: 'DESCRIPTION' as const,\n columnName: col.columnName,\n };\n default:\n return {\n type: 'NONE' as const,\n columnName: col.columnName,\n };\n }\n });\n\n // Build metadata\n const metadata = await nativeClient.buildImportJobMetadata(metadataColumns as any);\n\n if (overwriteCells) {\n (metadata as any).overwriteCells = true;\n }\n\n // Create import job\n const importActions = await nativeClient.createImportJob({\n title,\n metadata,\n labels,\n });\n\n // Add rows\n await importActions.addRows(rows as any);\n await importActions.flushRows();\n\n // Import dimensions if needed\n if (importDimensions) {\n await importActions.importDimensions();\n }\n\n // Undo previous if needed\n if (undoPrevious) {\n await importActions.undoPrevious();\n }\n\n // Commit\n const report = await importActions.commit();\n\n return successResponse({\n tenant,\n title,\n rowCount: rows.length,\n labels: labels || [],\n undoPrevious,\n importDimensions,\n overwriteCells,\n commitReport: report,\n });\n } catch (error) {\n return errorResponse(`Import job failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_create_file - Create or update file on instance\n registerTool(\n server,\n 'farseer_create_file',\n `Create or update a file on a Farseer instance.\n\nThis creates a file in the specified folder on the Farseer file system.\nIf a file with the same name already exists in that folder, it will be updated.\n\nThe folderPath is an array of folder names, starting from the root.\nDefault is [\"Files\"] which is the standard files folder.\n\nCommon use cases:\n- Creating CSV report files\n- Uploading configuration files\n- Saving processed data outputs`,\n createFileSchema,\n async (params: { fileName: string; folderPath?: string[]; content: string }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, client, native: nativeClient } = gate.session;\n\n try {\n const folderPath = params.folderPath || ['Files'];\n // Not nativeClient.getItemByPath: for a single-segment path that\n // name-searches the whole tenant and refuses on more than one\n // loose match, so a second folder called \"Files\" breaks it.\n const folder = await client.getFolderByPath(folderPath);\n if (!folder) {\n return errorResponse(`Folder \"${folderPath.join('/')}\" not found`, 'NOT_FOUND');\n }\n const buffer = Buffer.from(params.content, 'utf-8');\n\n // The SDK creates a new file through a signed Cloud Storage upload, which an agent\n // sandbox cannot reach. Its update path and the CLI's create both use the API, the\n // same multipart create `push` uses, so every login takes this one path.\n const items = await nativeClient.getFolderItems(folder.id);\n const existing = items.find((item) => item.name === params.fileName);\n if (existing) await nativeClient.createOrUpdateFarseerFile(existing, buffer);\n else await client.createFile(buffer, params.fileName, folderPath);\n\n return successResponse({\n tenant,\n fileName: params.fileName,\n folderPath,\n size: buffer.length,\n message: `File \"${params.fileName}\" created/updated in ${folderPath.join('/')}`,\n });\n } catch (error) {\n return errorResponse(`Create file failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n}\n\n/**\n * Export variable data as CSV using evaluatorExport (works on all server versions).\n * Falls back to exportFormula if evaluatorExport fails.\n */\n/**\n * Export variable data as CSV using exportFormula.\n * Wraps the variable name in quotes as required by the API.\n * Supports dimension filters: [[\"Months\",\"M1\"],[\"Brand\",\"0000032\"]]\n * becomes sum(\"VarName\", \"Months\">\"M1\", \"Brand\">\"0000032\")\n */\nasync function exportVariableAsCsv(\n client: farseer.FarseerClient,\n variableName: string,\n limit?: number,\n filters?: Array<Array<string>>,\n): Promise<string> {\n let formula: string;\n if (filters && filters.length > 0) {\n const filterParts = filters.map(([table, member]) => `\"${table}\">\"${member}\"`).join(', ');\n formula = `sum(\"${variableName}\", ${filterParts})`;\n } else {\n formula = `\"${variableName}\"`;\n }\n\n const blob = await client.export.exportFormula({\n formula,\n format: farseer.ExportFormat.Csv,\n limit,\n });\n return await blob.text();\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,0BAA6B;AAC7B,iBAAkB;AAClB,SAAoB;AACpB,WAAsB;AACtB,SAAoB;AACpB,cAAyB;AACzB,qBAA+B;AAC/B,qBAA+C;AAC/C,4BAAkC;AAGlC,MAAM,2BAA2B;AAAA,EAC7B,cAAc,aAAE,OAAO,EAAE,SAAS,gCAAgC;AAAA,EAClE,SAAS,aACJ,MAAM,aAAE,MAAM,aAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,EACnC,SAAS,EACT;AAAA,IACG;AAAA,EACJ;AAAA,EACJ,QAAQ,aAAE,KAAK,CAAC,OAAO,MAAM,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7B;AAAA,EACJ,CAAC;AACD,SAAO,MAAM,KAAK,KAAK;AAC3B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -31,13 +31,15 @@ __export(folderTools_exports, {
|
|
|
31
31
|
registerFolderTools: () => registerFolderTools
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(folderTools_exports);
|
|
34
|
+
var import_registerTool = require("../utils/registerTool");
|
|
34
35
|
var import_zod = require("zod");
|
|
35
36
|
var farseer = __toESM(require("farseer-client"));
|
|
36
37
|
var import_session = require("../utils/session");
|
|
37
38
|
var import_helpers = require("../utils/helpers");
|
|
38
39
|
var import_errorFormatter = require("../../utils/errorFormatter");
|
|
39
40
|
function registerFolderTools(server) {
|
|
40
|
-
|
|
41
|
+
(0, import_registerTool.registerTool)(
|
|
42
|
+
server,
|
|
41
43
|
"farseer_create_folder",
|
|
42
44
|
`Create a new folder in the Farseer folder tree.
|
|
43
45
|
|
|
@@ -50,7 +52,6 @@ If no parent is specified, creates in the root.`,
|
|
|
50
52
|
parentId: import_zod.z.number().optional().describe("Parent folder ID. If omitted, searches by parentPath or uses root."),
|
|
51
53
|
parentPath: import_zod.z.array(import_zod.z.string()).optional().describe('Parent folder path as array (e.g., ["Variables", "Revenue"]). Alternative to parentId.')
|
|
52
54
|
},
|
|
53
|
-
// @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas
|
|
54
55
|
async (params) => {
|
|
55
56
|
const gate = await (0, import_session.requireSession)();
|
|
56
57
|
if (!gate.ok) return gate.response;
|
|
@@ -87,7 +88,8 @@ If no parent is specified, creates in the root.`,
|
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
);
|
|
90
|
-
|
|
91
|
+
(0, import_registerTool.registerTool)(
|
|
92
|
+
server,
|
|
91
93
|
"farseer_move_items",
|
|
92
94
|
`Move items (variables, dashboards, sheets, folders) to a different folder.
|
|
93
95
|
|
|
@@ -102,7 +104,6 @@ Example: Move items 400 and 401 to folder 42:
|
|
|
102
104
|
itemIds: import_zod.z.array(import_zod.z.number()).describe("Folder item IDs to move (NOT entity IDs \u2014 use folder tree to find these)"),
|
|
103
105
|
targetFolderId: import_zod.z.number().describe("Target folder ID")
|
|
104
106
|
},
|
|
105
|
-
// @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas
|
|
106
107
|
async (params) => {
|
|
107
108
|
const gate = await (0, import_session.requireSession)();
|
|
108
109
|
if (!gate.ok) return gate.response;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/mcp/tools/folderTools.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Folder Management Tools\n *\n * MCP tools for creating folders and moving items (variables, dashboards, sheets) between folders.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport * as farseer from 'farseer-client';\nimport { requireSession } from '../utils/session';\nimport { successResponse, errorResponse } from '../utils/helpers';\nimport { formatClientError } from '../../utils/errorFormatter';\n\nexport function registerFolderTools(server: McpServer): void {\n // farseer_create_folder\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAkB;AAClB,cAAyB;AACzB,qBAA+B;AAC/B,qBAA+C;AAC/C,4BAAkC;AAE3B,SAAS,oBAAoB,QAAyB;AAEzD,
|
|
4
|
+
"sourcesContent": ["/**\n * Folder Management Tools\n *\n * MCP tools for creating folders and moving items (variables, dashboards, sheets) between folders.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { registerTool } from '../utils/registerTool';\nimport { z } from 'zod';\nimport * as farseer from 'farseer-client';\nimport { requireSession } from '../utils/session';\nimport { successResponse, errorResponse } from '../utils/helpers';\nimport { formatClientError } from '../../utils/errorFormatter';\n\nexport function registerFolderTools(server: McpServer): void {\n // farseer_create_folder\n registerTool(\n server,\n 'farseer_create_folder',\n `Create a new folder in the Farseer folder tree.\n\nFolders organize variables, dashboards, sheets, and dimension tables.\nSpecify a parent folder by ID or path.\n\nIf no parent is specified, creates in the root.`,\n {\n name: z.string().describe('Folder name'),\n parentId: z\n .number()\n .optional()\n .describe('Parent folder ID. If omitted, searches by parentPath or uses root.'),\n parentPath: z\n .array(z.string())\n .optional()\n .describe('Parent folder path as array (e.g., [\"Variables\", \"Revenue\"]). Alternative to parentId.'),\n },\n async (params: { name: string; parentId?: number; parentPath?: string[] }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, native: nativeClient } = gate.session;\n\n try {\n let parentId = params.parentId ?? null;\n\n if (parentId === null && params.parentPath && params.parentPath.length > 0) {\n const folderResults = await nativeClient.folders.search({\n name: params.parentPath[params.parentPath.length - 1],\n types: [farseer.FolderItemType.Folder],\n limit: 20,\n });\n if (folderResults.length > 0) {\n parentId = folderResults[0].id;\n }\n }\n\n const result = await nativeClient.folders.create({\n parentId,\n name: params.name,\n allowedTypes: null,\n } as any);\n\n return successResponse({\n tenant,\n action: 'created',\n folder: {\n id: (result as any).id,\n name: params.name,\n parentId,\n },\n message: `Folder \"${params.name}\" created`,\n });\n } catch (error) {\n return errorResponse(`Create folder failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_move_items\n registerTool(\n server,\n 'farseer_move_items',\n `Move items (variables, dashboards, sheets, folders) to a different folder.\n\nIMPORTANT: Use folder item IDs, NOT entity IDs. These are different!\nUse farseer_list_dashboards (includeFolderPath), farseer_list_variables, or\ncheck the folder tree to find folder item IDs.\n\nExample: Move items 400 and 401 to folder 42:\n itemIds: [400, 401]\n targetFolderId: 42`,\n {\n itemIds: z\n .array(z.number())\n .describe('Folder item IDs to move (NOT entity IDs \u2014 use folder tree to find these)'),\n targetFolderId: z.number().describe('Target folder ID'),\n },\n async (params: { itemIds: number[]; targetFolderId: number }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, native: nativeClient } = gate.session;\n\n try {\n const moveRequests = params.itemIds.map((id, index) => ({\n id,\n parentId: params.targetFolderId,\n order: index,\n }));\n await nativeClient.folders.moveItemsBatch(moveRequests as any);\n\n return successResponse({\n tenant,\n action: 'moved',\n itemCount: params.itemIds.length,\n targetFolderId: params.targetFolderId,\n message: `Moved ${params.itemIds.length} item(s) to folder ${params.targetFolderId}`,\n });\n } catch (error) {\n return errorResponse(`Move items failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAA6B;AAC7B,iBAAkB;AAClB,cAAyB;AACzB,qBAA+B;AAC/B,qBAA+C;AAC/C,4BAAkC;AAE3B,SAAS,oBAAoB,QAAyB;AAEzD;AAAA,IACI;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA;AAAA,MACI,MAAM,aAAE,OAAO,EAAE,SAAS,aAAa;AAAA,MACvC,UAAU,aACL,OAAO,EACP,SAAS,EACT,SAAS,oEAAoE;AAAA,MAClF,YAAY,aACP,MAAM,aAAE,OAAO,CAAC,EAChB,SAAS,EACT,SAAS,wFAAwF;AAAA,IAC1G;AAAA,IACA,OAAO,WAAuE;AAC1E,YAAM,OAAO,UAAM,+BAAe;AAClC,UAAI,CAAC,KAAK,GAAI,QAAO,KAAK;AAC1B,YAAM,EAAE,QAAQ,QAAQ,aAAa,IAAI,KAAK;AAE9C,UAAI;AACA,YAAI,WAAW,OAAO,YAAY;AAElC,YAAI,aAAa,QAAQ,OAAO,cAAc,OAAO,WAAW,SAAS,GAAG;AACxE,gBAAM,gBAAgB,MAAM,aAAa,QAAQ,OAAO;AAAA,YACpD,MAAM,OAAO,WAAW,OAAO,WAAW,SAAS,CAAC;AAAA,YACpD,OAAO,CAAC,QAAQ,eAAe,MAAM;AAAA,YACrC,OAAO;AAAA,UACX,CAA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sBAAsB,OAAO,cAAc;AAAA,QACtF,CAAC;AAAA,MACL,SAAS,OAAO;AACZ,mBAAO,8BAAc,sBAAsB,UAAM,yCAAkB,KAAK,CAAC,IAAI,eAAe;AAAA,MAChG;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -31,6 +31,7 @@ __export(modelTools_exports, {
|
|
|
31
31
|
registerModelTools: () => registerModelTools
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(modelTools_exports);
|
|
34
|
+
var import_registerTool = require("../utils/registerTool");
|
|
34
35
|
var import_zod = require("zod");
|
|
35
36
|
var fs = __toESM(require("fs"));
|
|
36
37
|
var path = __toESM(require("path"));
|
|
@@ -133,7 +134,8 @@ async function folderFor(nativeClient, folderPath) {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
function registerModelTools(server) {
|
|
136
|
-
|
|
137
|
+
(0, import_registerTool.registerTool)(
|
|
138
|
+
server,
|
|
137
139
|
"farseer_export_model",
|
|
138
140
|
`Export the complete data model structure from a Farseer tenant.
|
|
139
141
|
|
|
@@ -217,7 +219,8 @@ For a quick overview without the full export, use farseer_list_tables or farseer
|
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
);
|
|
220
|
-
|
|
222
|
+
(0, import_registerTool.registerTool)(
|
|
223
|
+
server,
|
|
221
224
|
"farseer_list_tables",
|
|
222
225
|
`List all dimension tables in a Farseer tenant model.
|
|
223
226
|
|
|
@@ -249,7 +252,8 @@ Returns table names, member counts, and foreign key relationships.`,
|
|
|
249
252
|
}
|
|
250
253
|
}
|
|
251
254
|
);
|
|
252
|
-
|
|
255
|
+
(0, import_registerTool.registerTool)(
|
|
256
|
+
server,
|
|
253
257
|
"farseer_list_variables",
|
|
254
258
|
`List all variables defined in a Farseer tenant model.
|
|
255
259
|
|
|
@@ -299,7 +303,8 @@ Each variable has:
|
|
|
299
303
|
}
|
|
300
304
|
}
|
|
301
305
|
);
|
|
302
|
-
|
|
306
|
+
(0, import_registerTool.registerTool)(
|
|
307
|
+
server,
|
|
303
308
|
"farseer_get_table",
|
|
304
309
|
`Get detailed information about a specific dimension table.
|
|
305
310
|
|
|
@@ -345,7 +350,8 @@ This helps understand the structure needed for import scripts.`,
|
|
|
345
350
|
}
|
|
346
351
|
}
|
|
347
352
|
);
|
|
348
|
-
|
|
353
|
+
(0, import_registerTool.registerTool)(
|
|
354
|
+
server,
|
|
349
355
|
"farseer_get_variable",
|
|
350
356
|
`Get detailed information about a specific variable.
|
|
351
357
|
|
|
@@ -400,7 +406,8 @@ This is essential for understanding what dimensions and values are needed for im
|
|
|
400
406
|
}
|
|
401
407
|
}
|
|
402
408
|
);
|
|
403
|
-
|
|
409
|
+
(0, import_registerTool.registerTool)(
|
|
410
|
+
server,
|
|
404
411
|
"farseer_evaluate_formula",
|
|
405
412
|
`Evaluate a formula expression in a Farseer tenant.
|
|
406
413
|
|
|
@@ -413,7 +420,6 @@ Example: evaluate "Revenue" with filters [["Years","Y2025"],["Months","M1"]]
|
|
|
413
420
|
|
|
414
421
|
Returns the computed value along with cell metadata (readonly, calculated, frozen).`,
|
|
415
422
|
evaluateFormulaSchema,
|
|
416
|
-
// @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas
|
|
417
423
|
async (params) => {
|
|
418
424
|
const gate = await (0, import_session.requireSession)();
|
|
419
425
|
if (!gate.ok) return gate.response;
|
|
@@ -446,7 +452,8 @@ Returns the computed value along with cell metadata (readonly, calculated, froze
|
|
|
446
452
|
}
|
|
447
453
|
}
|
|
448
454
|
);
|
|
449
|
-
|
|
455
|
+
(0, import_registerTool.registerTool)(
|
|
456
|
+
server,
|
|
450
457
|
"farseer_list_dimension_members",
|
|
451
458
|
`List all members of a specific dimension table.
|
|
452
459
|
|
|
@@ -510,7 +517,8 @@ instead of inline data, to avoid overwhelming the context window.`,
|
|
|
510
517
|
}
|
|
511
518
|
}
|
|
512
519
|
);
|
|
513
|
-
|
|
520
|
+
(0, import_registerTool.registerTool)(
|
|
521
|
+
server,
|
|
514
522
|
"farseer_manage_dimension_members",
|
|
515
523
|
`Create or delete a dimension member in a Farseer tenant.
|
|
516
524
|
|
|
@@ -588,7 +596,8 @@ WARNING: Delete is destructive and may affect data. Use with caution.`,
|
|
|
588
596
|
}
|
|
589
597
|
}
|
|
590
598
|
);
|
|
591
|
-
|
|
599
|
+
(0, import_registerTool.registerTool)(
|
|
600
|
+
server,
|
|
592
601
|
"farseer_create_table",
|
|
593
602
|
`Create a new dimension table in a Farseer tenant.
|
|
594
603
|
|
|
@@ -598,7 +607,6 @@ Creates an empty table that you can then add members to with farseer_manage_dime
|
|
|
598
607
|
name: import_zod.z.string().describe("Dimension table name"),
|
|
599
608
|
folderPath: import_zod.z.array(import_zod.z.string()).optional().describe('Folder path (e.g., ["Dimensions"]). Uses create + move.')
|
|
600
609
|
},
|
|
601
|
-
// @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas
|
|
602
610
|
async (params) => {
|
|
603
611
|
const gate = await (0, import_session.requireSession)();
|
|
604
612
|
if (!gate.ok) return gate.response;
|
|
@@ -636,7 +644,8 @@ Creates an empty table that you can then add members to with farseer_manage_dime
|
|
|
636
644
|
}
|
|
637
645
|
}
|
|
638
646
|
);
|
|
639
|
-
|
|
647
|
+
(0, import_registerTool.registerTool)(
|
|
648
|
+
server,
|
|
640
649
|
"farseer_create_variable",
|
|
641
650
|
`Create a new variable in a Farseer tenant.
|
|
642
651
|
|
|
@@ -652,7 +661,6 @@ Example:
|
|
|
652
661
|
"dataType": "Decimal"
|
|
653
662
|
}`,
|
|
654
663
|
createVariableSchema,
|
|
655
|
-
// @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas
|
|
656
664
|
async (params) => {
|
|
657
665
|
const gate = await (0, import_session.requireSession)();
|
|
658
666
|
if (!gate.ok) return gate.response;
|
|
@@ -712,7 +720,8 @@ Example:
|
|
|
712
720
|
}
|
|
713
721
|
}
|
|
714
722
|
);
|
|
715
|
-
|
|
723
|
+
(0, import_registerTool.registerTool)(
|
|
724
|
+
server,
|
|
716
725
|
"farseer_update_variable",
|
|
717
726
|
`Update an existing variable in a Farseer tenant.
|
|
718
727
|
|
|
@@ -729,7 +738,6 @@ Updatable fields:
|
|
|
729
738
|
- polarity: Set number polarity (POSITIVE or NEGATIVE)
|
|
730
739
|
- numberFormat: Full number format config (type, decimals, polarity, unit, currency, etc.)`,
|
|
731
740
|
updateVariableSchema,
|
|
732
|
-
// @ts-expect-error TS2589 - MCP SDK deep type inference with zod schemas
|
|
733
741
|
async (params) => {
|
|
734
742
|
const gate = await (0, import_session.requireSession)();
|
|
735
743
|
if (!gate.ok) return gate.response;
|
|
@@ -795,7 +803,8 @@ Updatable fields:
|
|
|
795
803
|
}
|
|
796
804
|
}
|
|
797
805
|
);
|
|
798
|
-
|
|
806
|
+
(0, import_registerTool.registerTool)(
|
|
807
|
+
server,
|
|
799
808
|
"farseer_delete_variable_data",
|
|
800
809
|
`Delete ALL data for a variable in a Farseer tenant.
|
|
801
810
|
|
|
@@ -827,7 +836,8 @@ Use this to clear old template data or reset a variable before re-importing.`,
|
|
|
827
836
|
}
|
|
828
837
|
}
|
|
829
838
|
);
|
|
830
|
-
|
|
839
|
+
(0, import_registerTool.registerTool)(
|
|
840
|
+
server,
|
|
831
841
|
"farseer_delete_variable",
|
|
832
842
|
`Delete a variable from a Farseer tenant.
|
|
833
843
|
|