@ffschrattenecker/tm1-mcp-server 6.0.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/CHANGELOG.md +1211 -0
- package/LICENSE +21 -0
- package/NOTICE +34 -0
- package/README.md +276 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.js +238 -0
- package/dist/http-transport.d.ts +8 -0
- package/dist/http-transport.js +132 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +164 -0
- package/dist/lib/callgraph/callGraph.d.ts +124 -0
- package/dist/lib/callgraph/callGraph.js +334 -0
- package/dist/lib/callgraph/choreGraph.d.ts +23 -0
- package/dist/lib/callgraph/choreGraph.js +102 -0
- package/dist/lib/callgraph/dataFlow.d.ts +74 -0
- package/dist/lib/callgraph/dataFlow.js +271 -0
- package/dist/lib/callgraph/datasourceMembership.d.ts +31 -0
- package/dist/lib/callgraph/datasourceMembership.js +142 -0
- package/dist/lib/callgraph/lintTypes.d.ts +28 -0
- package/dist/lib/callgraph/lintTypes.js +2 -0
- package/dist/lib/callgraph/mdxMembers.d.ts +29 -0
- package/dist/lib/callgraph/mdxMembers.js +97 -0
- package/dist/lib/callgraph/referenceIndex.d.ts +179 -0
- package/dist/lib/callgraph/referenceIndex.js +584 -0
- package/dist/lib/callgraph/rulesLinter.d.ts +55 -0
- package/dist/lib/callgraph/rulesLinter.js +776 -0
- package/dist/lib/callgraph/rulesParser.d.ts +26 -0
- package/dist/lib/callgraph/rulesParser.js +71 -0
- package/dist/lib/callgraph/subsetUsage.d.ts +16 -0
- package/dist/lib/callgraph/subsetUsage.js +134 -0
- package/dist/lib/callgraph/tiParser.d.ts +21 -0
- package/dist/lib/callgraph/tiParser.js +672 -0
- package/dist/lib/callgraph/tiSignatures.d.ts +32 -0
- package/dist/lib/callgraph/tiSignatures.js +6185 -0
- package/dist/lib/callgraph/tm1-adapter.d.ts +32 -0
- package/dist/lib/callgraph/tm1-adapter.js +159 -0
- package/dist/lib/callgraph/types.d.ts +53 -0
- package/dist/lib/callgraph/types.js +2 -0
- package/dist/lib/callgraph/variableEnv.d.ts +86 -0
- package/dist/lib/callgraph/variableEnv.js +214 -0
- package/dist/lib/cell-address.d.ts +12 -0
- package/dist/lib/cell-address.js +71 -0
- package/dist/lib/complexity/antipatterns.d.ts +22 -0
- package/dist/lib/complexity/antipatterns.js +302 -0
- package/dist/lib/complexity/comment-classifier.d.ts +24 -0
- package/dist/lib/complexity/comment-classifier.js +43 -0
- package/dist/lib/complexity/cross-process.d.ts +78 -0
- package/dist/lib/complexity/cross-process.js +114 -0
- package/dist/lib/complexity/process-metrics.d.ts +78 -0
- package/dist/lib/complexity/process-metrics.js +278 -0
- package/dist/lib/complexity/rules-metrics.d.ts +31 -0
- package/dist/lib/complexity/rules-metrics.js +99 -0
- package/dist/lib/concurrency.d.ts +11 -0
- package/dist/lib/concurrency.js +27 -0
- package/dist/lib/control-name.d.ts +10 -0
- package/dist/lib/control-name.js +10 -0
- package/dist/lib/coordinate-error.d.ts +3 -0
- package/dist/lib/coordinate-error.js +29 -0
- package/dist/lib/credential-format.d.ts +23 -0
- package/dist/lib/credential-format.js +25 -0
- package/dist/lib/cube-stats/fetcher.d.ts +106 -0
- package/dist/lib/cube-stats/fetcher.js +194 -0
- package/dist/lib/feeders/brackets.d.ts +47 -0
- package/dist/lib/feeders/brackets.js +195 -0
- package/dist/lib/feeders/element-type-cache.d.ts +42 -0
- package/dist/lib/feeders/element-type-cache.js +86 -0
- package/dist/lib/feeders/static-heuristics.d.ts +101 -0
- package/dist/lib/feeders/static-heuristics.js +202 -0
- package/dist/lib/git-process.d.ts +67 -0
- package/dist/lib/git-process.js +243 -0
- package/dist/lib/mask-secrets.d.ts +10 -0
- package/dist/lib/mask-secrets.js +99 -0
- package/dist/lib/mdx.d.ts +3 -0
- package/dist/lib/mdx.js +13 -0
- package/dist/lib/naming/odata-filter.d.ts +15 -0
- package/dist/lib/naming/odata-filter.js +81 -0
- package/dist/lib/naming/rules.d.ts +34 -0
- package/dist/lib/naming/rules.js +215 -0
- package/dist/lib/pro-parser.d.ts +19 -0
- package/dist/lib/pro-parser.js +260 -0
- package/dist/lib/pro-serializer.d.ts +19 -0
- package/dist/lib/pro-serializer.js +170 -0
- package/dist/lib/process-parts-schema.d.ts +45 -0
- package/dist/lib/process-parts-schema.js +46 -0
- package/dist/lib/process-refs.d.ts +88 -0
- package/dist/lib/process-refs.js +441 -0
- package/dist/lib/rules-outline.d.ts +29 -0
- package/dist/lib/rules-outline.js +68 -0
- package/dist/lib/rules-patch.d.ts +6 -0
- package/dist/lib/rules-patch.js +59 -0
- package/dist/lib/safe-regex.d.ts +15 -0
- package/dist/lib/safe-regex.js +37 -0
- package/dist/lib/sample-cells.d.ts +48 -0
- package/dist/lib/sample-cells.js +146 -0
- package/dist/lib/slim-json-schema.d.ts +20 -0
- package/dist/lib/slim-json-schema.js +68 -0
- package/dist/lib/strip-comments.d.ts +23 -0
- package/dist/lib/strip-comments.js +61 -0
- package/dist/lib/tm1-events.d.ts +16 -0
- package/dist/lib/tm1-events.js +29 -0
- package/dist/lib/v12-compat/deprecated-ti.d.ts +17 -0
- package/dist/lib/v12-compat/deprecated-ti.js +257 -0
- package/dist/lib/v12-compat/scanner.d.ts +10 -0
- package/dist/lib/v12-compat/scanner.js +43 -0
- package/dist/lib/variables-ui-data.d.ts +26 -0
- package/dist/lib/variables-ui-data.js +77 -0
- package/dist/load-env.d.ts +2 -0
- package/dist/load-env.js +29 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +60 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.js +141 -0
- package/dist/resources/index.d.ts +5 -0
- package/dist/resources/index.js +237 -0
- package/dist/resources/list-handler.d.ts +40 -0
- package/dist/resources/list-handler.js +86 -0
- package/dist/resources/subscriptions.d.ts +19 -0
- package/dist/resources/subscriptions.js +80 -0
- package/dist/schemas/cells.d.ts +17 -0
- package/dist/schemas/cells.js +13 -0
- package/dist/schemas/common.d.ts +16 -0
- package/dist/schemas/common.js +14 -0
- package/dist/schemas/index.d.ts +10 -0
- package/dist/schemas/index.js +23 -0
- package/dist/schemas/metadata.d.ts +70 -0
- package/dist/schemas/metadata.js +47 -0
- package/dist/schemas/monitoring.d.ts +95 -0
- package/dist/schemas/monitoring.js +69 -0
- package/dist/schemas/processes.d.ts +74 -0
- package/dist/schemas/processes.js +66 -0
- package/dist/schemas/scheduling.d.ts +13 -0
- package/dist/schemas/scheduling.js +13 -0
- package/dist/schemas/security.d.ts +19 -0
- package/dist/schemas/security.js +16 -0
- package/dist/schemas/subsets.d.ts +12 -0
- package/dist/schemas/subsets.js +12 -0
- package/dist/schemas/views.d.ts +9 -0
- package/dist/schemas/views.js +9 -0
- package/dist/session-manager.d.ts +79 -0
- package/dist/session-manager.js +281 -0
- package/dist/tm1-client/connection/profile.d.ts +13 -0
- package/dist/tm1-client/connection/profile.js +99 -0
- package/dist/tm1-client/dispatcher.d.ts +5 -0
- package/dist/tm1-client/dispatcher.js +31 -0
- package/dist/tm1-client/http.d.ts +81 -0
- package/dist/tm1-client/http.js +547 -0
- package/dist/tm1-client/services/batch-service.d.ts +123 -0
- package/dist/tm1-client/services/batch-service.js +455 -0
- package/dist/tm1-client/services/cell-service.d.ts +71 -0
- package/dist/tm1-client/services/cell-service.js +333 -0
- package/dist/tm1-client/services/cellset-transform.d.ts +26 -0
- package/dist/tm1-client/services/cellset-transform.js +80 -0
- package/dist/tm1-client/services/chore-service.d.ts +68 -0
- package/dist/tm1-client/services/chore-service.js +179 -0
- package/dist/tm1-client/services/chore-status.d.ts +11 -0
- package/dist/tm1-client/services/chore-status.js +127 -0
- package/dist/tm1-client/services/cube-service.d.ts +134 -0
- package/dist/tm1-client/services/cube-service.js +294 -0
- package/dist/tm1-client/services/dimension-service.d.ts +118 -0
- package/dist/tm1-client/services/dimension-service.js +249 -0
- package/dist/tm1-client/services/element-service.d.ts +245 -0
- package/dist/tm1-client/services/element-service.js +809 -0
- package/dist/tm1-client/services/fallback.d.ts +44 -0
- package/dist/tm1-client/services/fallback.js +72 -0
- package/dist/tm1-client/services/file-service.d.ts +53 -0
- package/dist/tm1-client/services/file-service.js +218 -0
- package/dist/tm1-client/services/hierarchy-service.d.ts +129 -0
- package/dist/tm1-client/services/hierarchy-service.js +332 -0
- package/dist/tm1-client/services/monitoring-service.d.ts +34 -0
- package/dist/tm1-client/services/monitoring-service.js +123 -0
- package/dist/tm1-client/services/odata-page.d.ts +71 -0
- package/dist/tm1-client/services/odata-page.js +87 -0
- package/dist/tm1-client/services/process-service.d.ts +278 -0
- package/dist/tm1-client/services/process-service.js +874 -0
- package/dist/tm1-client/services/process-status.d.ts +21 -0
- package/dist/tm1-client/services/process-status.js +89 -0
- package/dist/tm1-client/services/security-service.d.ts +50 -0
- package/dist/tm1-client/services/security-service.js +93 -0
- package/dist/tm1-client/services/server-service.d.ts +116 -0
- package/dist/tm1-client/services/server-service.js +504 -0
- package/dist/tm1-client/services/subset-service.d.ts +37 -0
- package/dist/tm1-client/services/subset-service.js +122 -0
- package/dist/tm1-client/services/view-service.d.ts +46 -0
- package/dist/tm1-client/services/view-service.js +287 -0
- package/dist/tm1-client.d.ts +56 -0
- package/dist/tm1-client.js +126 -0
- package/dist/tools/analysis/analyze-callgraph.d.ts +28 -0
- package/dist/tools/analysis/analyze-callgraph.js +350 -0
- package/dist/tools/analysis/analyze-chore-graph.d.ts +2 -0
- package/dist/tools/analysis/analyze-chore-graph.js +148 -0
- package/dist/tools/analysis/analyze-object-usage.d.ts +2 -0
- package/dist/tools/analysis/analyze-object-usage.js +143 -0
- package/dist/tools/analysis/audit-complexity.d.ts +2 -0
- package/dist/tools/analysis/audit-complexity.js +255 -0
- package/dist/tools/analysis/audit-feeders.d.ts +2 -0
- package/dist/tools/analysis/audit-feeders.js +417 -0
- package/dist/tools/analysis/audit-naming.d.ts +2 -0
- package/dist/tools/analysis/audit-naming.js +379 -0
- package/dist/tools/analysis/check-v12-readiness.d.ts +2 -0
- package/dist/tools/analysis/check-v12-readiness.js +136 -0
- package/dist/tools/analysis/find-orphan-dimensions.d.ts +2 -0
- package/dist/tools/analysis/find-orphan-dimensions.js +55 -0
- package/dist/tools/analysis/invalidate-callgraph-cache.d.ts +2 -0
- package/dist/tools/analysis/invalidate-callgraph-cache.js +40 -0
- package/dist/tools/analysis/trace-data-flow.d.ts +2 -0
- package/dist/tools/analysis/trace-data-flow.js +138 -0
- package/dist/tools/annotations.d.ts +12 -0
- package/dist/tools/annotations.js +61 -0
- package/dist/tools/celldata/check-feeders.d.ts +2 -0
- package/dist/tools/celldata/check-feeders.js +48 -0
- package/dist/tools/celldata/check-writable-coords.d.ts +2 -0
- package/dist/tools/celldata/check-writable-coords.js +126 -0
- package/dist/tools/celldata/execute-mdx.d.ts +17 -0
- package/dist/tools/celldata/execute-mdx.js +126 -0
- package/dist/tools/celldata/get-cell-value.d.ts +2 -0
- package/dist/tools/celldata/get-cell-value.js +30 -0
- package/dist/tools/celldata/get-view-definition.d.ts +2 -0
- package/dist/tools/celldata/get-view-definition.js +29 -0
- package/dist/tools/celldata/get-view.d.ts +2 -0
- package/dist/tools/celldata/get-view.js +55 -0
- package/dist/tools/celldata/sample-cells.d.ts +2 -0
- package/dist/tools/celldata/sample-cells.js +101 -0
- package/dist/tools/celldata/trace-cell-calculation.d.ts +2 -0
- package/dist/tools/celldata/trace-cell-calculation.js +53 -0
- package/dist/tools/celldata/trace-feeders.d.ts +2 -0
- package/dist/tools/celldata/trace-feeders.js +44 -0
- package/dist/tools/celldata/write-cells.d.ts +2 -0
- package/dist/tools/celldata/write-cells.js +65 -0
- package/dist/tools/confirm.d.ts +10 -0
- package/dist/tools/confirm.js +64 -0
- package/dist/tools/define-tool.d.ts +51 -0
- package/dist/tools/define-tool.js +49 -0
- package/dist/tools/dimension-management/bulk-upsert-elements.d.ts +2 -0
- package/dist/tools/dimension-management/bulk-upsert-elements.js +103 -0
- package/dist/tools/dimension-management/create-dimension.d.ts +2 -0
- package/dist/tools/dimension-management/create-dimension.js +22 -0
- package/dist/tools/dimension-management/create-element-attribute.d.ts +2 -0
- package/dist/tools/dimension-management/create-element-attribute.js +26 -0
- package/dist/tools/dimension-management/create-element.d.ts +2 -0
- package/dist/tools/dimension-management/create-element.js +31 -0
- package/dist/tools/dimension-management/create-hierarchy.d.ts +2 -0
- package/dist/tools/dimension-management/create-hierarchy.js +22 -0
- package/dist/tools/dimension-management/delete-dimension.d.ts +2 -0
- package/dist/tools/dimension-management/delete-dimension.js +25 -0
- package/dist/tools/dimension-management/delete-element.d.ts +2 -0
- package/dist/tools/dimension-management/delete-element.js +26 -0
- package/dist/tools/dimension-management/delete-elements.d.ts +2 -0
- package/dist/tools/dimension-management/delete-elements.js +44 -0
- package/dist/tools/dimension-management/delete-hierarchy.d.ts +2 -0
- package/dist/tools/dimension-management/delete-hierarchy.js +35 -0
- package/dist/tools/dimension-management/get-element-attribute-values.d.ts +2 -0
- package/dist/tools/dimension-management/get-element-attribute-values.js +77 -0
- package/dist/tools/dimension-management/list-element-attributes.d.ts +2 -0
- package/dist/tools/dimension-management/list-element-attributes.js +31 -0
- package/dist/tools/dimension-management/move-element.d.ts +2 -0
- package/dist/tools/dimension-management/move-element.js +28 -0
- package/dist/tools/dimension-management/update-element-attribute-value.d.ts +2 -0
- package/dist/tools/dimension-management/update-element-attribute-value.js +80 -0
- package/dist/tools/dimension-management/update-element.d.ts +2 -0
- package/dist/tools/dimension-management/update-element.js +35 -0
- package/dist/tools/error-format.d.ts +22 -0
- package/dist/tools/error-format.js +130 -0
- package/dist/tools/fileops/delete-file.d.ts +2 -0
- package/dist/tools/fileops/delete-file.js +32 -0
- package/dist/tools/fileops/get-file-content.d.ts +2 -0
- package/dist/tools/fileops/get-file-content.js +76 -0
- package/dist/tools/fileops/list-files.d.ts +2 -0
- package/dist/tools/fileops/list-files.js +43 -0
- package/dist/tools/fileops/search-files.d.ts +2 -0
- package/dist/tools/fileops/search-files.js +76 -0
- package/dist/tools/fileops/upload-file.d.ts +2 -0
- package/dist/tools/fileops/upload-file.js +69 -0
- package/dist/tools/format.d.ts +57 -0
- package/dist/tools/format.js +157 -0
- package/dist/tools/hierarchy.d.ts +6 -0
- package/dist/tools/hierarchy.js +27 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +263 -0
- package/dist/tools/local-file.d.ts +16 -0
- package/dist/tools/local-file.js +88 -0
- package/dist/tools/metadata/get-ancestors.d.ts +2 -0
- package/dist/tools/metadata/get-ancestors.js +36 -0
- package/dist/tools/metadata/get-descendants.d.ts +2 -0
- package/dist/tools/metadata/get-descendants.js +64 -0
- package/dist/tools/metadata/get-hierarchy.d.ts +2 -0
- package/dist/tools/metadata/get-hierarchy.js +130 -0
- package/dist/tools/metadata/list-chores.d.ts +2 -0
- package/dist/tools/metadata/list-chores.js +62 -0
- package/dist/tools/metadata/list-cubes.d.ts +2 -0
- package/dist/tools/metadata/list-cubes.js +128 -0
- package/dist/tools/metadata/list-dimensions.d.ts +2 -0
- package/dist/tools/metadata/list-dimensions.js +131 -0
- package/dist/tools/metadata/list-processes-grouped.d.ts +2 -0
- package/dist/tools/metadata/list-processes-grouped.js +96 -0
- package/dist/tools/metadata/list-processes.d.ts +2 -0
- package/dist/tools/metadata/list-processes.js +108 -0
- package/dist/tools/metadata/resolve-default-members.d.ts +2 -0
- package/dist/tools/metadata/resolve-default-members.js +46 -0
- package/dist/tools/model-building/check-cube-rule.d.ts +2 -0
- package/dist/tools/model-building/check-cube-rule.js +51 -0
- package/dist/tools/model-building/clear-cube.d.ts +2 -0
- package/dist/tools/model-building/clear-cube.js +46 -0
- package/dist/tools/model-building/create-cube.d.ts +2 -0
- package/dist/tools/model-building/create-cube.js +34 -0
- package/dist/tools/model-building/delete-cube.d.ts +2 -0
- package/dist/tools/model-building/delete-cube.js +27 -0
- package/dist/tools/model-building/get-all-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/get-all-cube-rules.js +149 -0
- package/dist/tools/model-building/get-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/get-cube-rules.js +69 -0
- package/dist/tools/model-building/rules-source.d.ts +21 -0
- package/dist/tools/model-building/rules-source.js +49 -0
- package/dist/tools/model-building/search-rules.d.ts +2 -0
- package/dist/tools/model-building/search-rules.js +132 -0
- package/dist/tools/model-building/set-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/set-cube-rules.js +81 -0
- package/dist/tools/model-building/unload-cube.d.ts +2 -0
- package/dist/tools/model-building/unload-cube.js +23 -0
- package/dist/tools/operations/diagnose-process-error.d.ts +2 -0
- package/dist/tools/operations/diagnose-process-error.js +178 -0
- package/dist/tools/operations/error-log-helpers.d.ts +25 -0
- package/dist/tools/operations/error-log-helpers.js +57 -0
- package/dist/tools/operations/get-audit-log.d.ts +2 -0
- package/dist/tools/operations/get-audit-log.js +70 -0
- package/dist/tools/operations/get-cube-stats.d.ts +2 -0
- package/dist/tools/operations/get-cube-stats.js +107 -0
- package/dist/tools/operations/get-error-log-content.d.ts +2 -0
- package/dist/tools/operations/get-error-log-content.js +164 -0
- package/dist/tools/operations/get-jobs.d.ts +3 -0
- package/dist/tools/operations/get-jobs.js +51 -0
- package/dist/tools/operations/get-message-log.d.ts +2 -0
- package/dist/tools/operations/get-message-log.js +63 -0
- package/dist/tools/operations/get-server-info.d.ts +2 -0
- package/dist/tools/operations/get-server-info.js +180 -0
- package/dist/tools/operations/get-server-state.d.ts +2 -0
- package/dist/tools/operations/get-server-state.js +129 -0
- package/dist/tools/operations/get-sessions.d.ts +2 -0
- package/dist/tools/operations/get-sessions.js +76 -0
- package/dist/tools/operations/get-threads.d.ts +3 -0
- package/dist/tools/operations/get-threads.js +50 -0
- package/dist/tools/operations/get-transaction-log.d.ts +2 -0
- package/dist/tools/operations/get-transaction-log.js +63 -0
- package/dist/tools/operations/list-error-logs.d.ts +8 -0
- package/dist/tools/operations/list-error-logs.js +157 -0
- package/dist/tools/operations/save-data.d.ts +2 -0
- package/dist/tools/operations/save-data.js +50 -0
- package/dist/tools/pagination.d.ts +32 -0
- package/dist/tools/pagination.js +116 -0
- package/dist/tools/scheduling/create-chore.d.ts +2 -0
- package/dist/tools/scheduling/create-chore.js +93 -0
- package/dist/tools/scheduling/delete-chore.d.ts +2 -0
- package/dist/tools/scheduling/delete-chore.js +22 -0
- package/dist/tools/scheduling/execute-chore.d.ts +2 -0
- package/dist/tools/scheduling/execute-chore.js +52 -0
- package/dist/tools/scheduling/toggle-chore.d.ts +2 -0
- package/dist/tools/scheduling/toggle-chore.js +22 -0
- package/dist/tools/scheduling/update-chore.d.ts +2 -0
- package/dist/tools/scheduling/update-chore.js +71 -0
- package/dist/tools/schemas/common.d.ts +10 -0
- package/dist/tools/schemas/common.js +23 -0
- package/dist/tools/schemas/items-analysis.d.ts +394 -0
- package/dist/tools/schemas/items-analysis.js +419 -0
- package/dist/tools/schemas/items-cells.d.ts +70 -0
- package/dist/tools/schemas/items-cells.js +65 -0
- package/dist/tools/schemas/items-common.d.ts +18 -0
- package/dist/tools/schemas/items-common.js +39 -0
- package/dist/tools/schemas/items-fileops.d.ts +11 -0
- package/dist/tools/schemas/items-fileops.js +13 -0
- package/dist/tools/schemas/items-metadata.d.ts +262 -0
- package/dist/tools/schemas/items-metadata.js +184 -0
- package/dist/tools/schemas/items-monitoring.d.ts +79 -0
- package/dist/tools/schemas/items-monitoring.js +78 -0
- package/dist/tools/schemas/items-processes.d.ts +279 -0
- package/dist/tools/schemas/items-processes.js +235 -0
- package/dist/tools/schemas/items-scheduling.d.ts +25 -0
- package/dist/tools/schemas/items-scheduling.js +26 -0
- package/dist/tools/schemas/items-security.d.ts +19 -0
- package/dist/tools/schemas/items-security.js +12 -0
- package/dist/tools/schemas/items-subsets.d.ts +2 -0
- package/dist/tools/schemas/items-subsets.js +4 -0
- package/dist/tools/schemas/items-views.d.ts +38 -0
- package/dist/tools/schemas/items-views.js +26 -0
- package/dist/tools/schemas/items.d.ts +12 -0
- package/dist/tools/schemas/items.js +23 -0
- package/dist/tools/schemas/markdown-capable.d.ts +21 -0
- package/dist/tools/schemas/markdown-capable.js +58 -0
- package/dist/tools/schemas/output-schema.d.ts +24 -0
- package/dist/tools/schemas/output-schema.js +25 -0
- package/dist/tools/security/assign-client-group.d.ts +2 -0
- package/dist/tools/security/assign-client-group.js +20 -0
- package/dist/tools/security/create-client.d.ts +2 -0
- package/dist/tools/security/create-client.js +28 -0
- package/dist/tools/security/delete-client.d.ts +2 -0
- package/dist/tools/security/delete-client.js +22 -0
- package/dist/tools/security/get-client.d.ts +2 -0
- package/dist/tools/security/get-client.js +20 -0
- package/dist/tools/security/list-clients.d.ts +2 -0
- package/dist/tools/security/list-clients.js +86 -0
- package/dist/tools/security/list-groups.d.ts +2 -0
- package/dist/tools/security/list-groups.js +43 -0
- package/dist/tools/security/remove-client-group.d.ts +2 -0
- package/dist/tools/security/remove-client-group.js +27 -0
- package/dist/tools/security/update-client.d.ts +2 -0
- package/dist/tools/security/update-client.js +22 -0
- package/dist/tools/subsets/create-subset.d.ts +2 -0
- package/dist/tools/subsets/create-subset.js +44 -0
- package/dist/tools/subsets/delete-subset.d.ts +2 -0
- package/dist/tools/subsets/delete-subset.js +26 -0
- package/dist/tools/subsets/get-subset.d.ts +2 -0
- package/dist/tools/subsets/get-subset.js +29 -0
- package/dist/tools/subsets/list-subsets.d.ts +2 -0
- package/dist/tools/subsets/list-subsets.js +36 -0
- package/dist/tools/subsets/update-subset.d.ts +2 -0
- package/dist/tools/subsets/update-subset.js +33 -0
- package/dist/tools/ti-development/check-process-code.d.ts +2 -0
- package/dist/tools/ti-development/check-process-code.js +96 -0
- package/dist/tools/ti-development/compile-process.d.ts +2 -0
- package/dist/tools/ti-development/compile-process.js +32 -0
- package/dist/tools/ti-development/copy-process.d.ts +2 -0
- package/dist/tools/ti-development/copy-process.js +32 -0
- package/dist/tools/ti-development/delete-process.d.ts +2 -0
- package/dist/tools/ti-development/delete-process.js +26 -0
- package/dist/tools/ti-development/diff-process-with-file.d.ts +2 -0
- package/dist/tools/ti-development/diff-process-with-file.js +208 -0
- package/dist/tools/ti-development/diff-processes.d.ts +2 -0
- package/dist/tools/ti-development/diff-processes.js +312 -0
- package/dist/tools/ti-development/execute-process.d.ts +8 -0
- package/dist/tools/ti-development/execute-process.js +109 -0
- package/dist/tools/ti-development/export-process-to-git.d.ts +2 -0
- package/dist/tools/ti-development/export-process-to-git.js +113 -0
- package/dist/tools/ti-development/export-process-to-pro.d.ts +2 -0
- package/dist/tools/ti-development/export-process-to-pro.js +117 -0
- package/dist/tools/ti-development/get-all-processes-code.d.ts +2 -0
- package/dist/tools/ti-development/get-all-processes-code.js +131 -0
- package/dist/tools/ti-development/get-process-code.d.ts +2 -0
- package/dist/tools/ti-development/get-process-code.js +100 -0
- package/dist/tools/ti-development/get-process-datasource.d.ts +2 -0
- package/dist/tools/ti-development/get-process-datasource.js +20 -0
- package/dist/tools/ti-development/get-process-parameters.d.ts +2 -0
- package/dist/tools/ti-development/get-process-parameters.js +25 -0
- package/dist/tools/ti-development/get-process-variables.d.ts +2 -0
- package/dist/tools/ti-development/get-process-variables.js +38 -0
- package/dist/tools/ti-development/get-process.d.ts +2 -0
- package/dist/tools/ti-development/get-process.js +163 -0
- package/dist/tools/ti-development/import-pro-file.d.ts +2 -0
- package/dist/tools/ti-development/import-pro-file.js +153 -0
- package/dist/tools/ti-development/import-process-from-git.d.ts +2 -0
- package/dist/tools/ti-development/import-process-from-git.js +198 -0
- package/dist/tools/ti-development/install-pro-bundle.d.ts +2 -0
- package/dist/tools/ti-development/install-pro-bundle.js +288 -0
- package/dist/tools/ti-development/preflight.d.ts +39 -0
- package/dist/tools/ti-development/preflight.js +56 -0
- package/dist/tools/ti-development/process-backup.d.ts +29 -0
- package/dist/tools/ti-development/process-backup.js +118 -0
- package/dist/tools/ti-development/search-code.d.ts +2 -0
- package/dist/tools/ti-development/search-code.js +208 -0
- package/dist/tools/ti-development/upsert-process.d.ts +2 -0
- package/dist/tools/ti-development/upsert-process.js +167 -0
- package/dist/tools/ti-development/validate-process-refs.d.ts +2 -0
- package/dist/tools/ti-development/validate-process-refs.js +73 -0
- package/dist/tools/views/create-mdx-view.d.ts +2 -0
- package/dist/tools/views/create-mdx-view.js +21 -0
- package/dist/tools/views/create-native-view.d.ts +2 -0
- package/dist/tools/views/create-native-view.js +81 -0
- package/dist/tools/views/delete-view.d.ts +2 -0
- package/dist/tools/views/delete-view.js +23 -0
- package/dist/tools/views/list-views.d.ts +2 -0
- package/dist/tools/views/list-views.js +32 -0
- package/dist/tools/with-annotations.d.ts +6 -0
- package/dist/tools/with-annotations.js +339 -0
- package/dist/types.d.ts +409 -0
- package/dist/types.js +91 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +18 -0
- package/package.json +107 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Centralized MCP error result formatting. Closes audit gaps 5 (actionable
|
|
2
|
+
// hints) and 6 (uniform error shape) without per-tool edits — the index.ts
|
|
3
|
+
// Proxy invokes these helpers so every tool emits the same JSON shape:
|
|
4
|
+
//
|
|
5
|
+
// { code, message, httpStatus?, endpoint?, details?, hint }
|
|
6
|
+
//
|
|
7
|
+
// formatTm1ErrorResult: wrap a thrown error into the MCP result envelope.
|
|
8
|
+
// normalizeErrorResult: rewrite an already-emitted isError result to the
|
|
9
|
+
// uniform shape, parsing existing JSON when present and falling back to
|
|
10
|
+
// treating plain-text bodies as TM1_ERROR messages.
|
|
11
|
+
import { TM1Error, TM1ErrorCode, hintForCode } from "../types.js";
|
|
12
|
+
import { maskSecretValues } from "../lib/mask-secrets.js";
|
|
13
|
+
const DEFAULT_CODE = TM1ErrorCode.TM1_ERROR;
|
|
14
|
+
// Second net on the error path. classifyHttpError already sanitizes whatever
|
|
15
|
+
// TM1 said, but this envelope also carries errors that never went through it —
|
|
16
|
+
// a driver message rethrown by a service, a third-party library's text. Those
|
|
17
|
+
// reach the client here, so they get the same value-oriented masking.
|
|
18
|
+
// Idempotent: masking an already-masked string is a no-op.
|
|
19
|
+
function sanitize(payload) {
|
|
20
|
+
return {
|
|
21
|
+
...payload,
|
|
22
|
+
message: maskSecretValues(payload.message),
|
|
23
|
+
...(payload.details !== undefined
|
|
24
|
+
? { details: maskSecretValues(payload.details) }
|
|
25
|
+
: {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function payloadFromUnknown(err) {
|
|
29
|
+
if (err instanceof TM1Error) {
|
|
30
|
+
return sanitize(err.toErrorPayload());
|
|
31
|
+
}
|
|
32
|
+
if (err instanceof Error) {
|
|
33
|
+
return sanitize({
|
|
34
|
+
code: DEFAULT_CODE,
|
|
35
|
+
message: err.message,
|
|
36
|
+
hint: hintForCode(DEFAULT_CODE),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return sanitize({
|
|
40
|
+
code: DEFAULT_CODE,
|
|
41
|
+
message: String(err),
|
|
42
|
+
hint: hintForCode(DEFAULT_CODE),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function formatTm1ErrorResult(err) {
|
|
46
|
+
const payload = payloadFromUnknown(err);
|
|
47
|
+
return {
|
|
48
|
+
isError: true,
|
|
49
|
+
content: [{ type: "text", text: JSON.stringify(payload) }],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Re-shape an isError result that came back from a tool's own try/catch.
|
|
53
|
+
// Returns the original result unchanged when it's not safe to rewrite
|
|
54
|
+
// (no content, non-text content, etc.) so we never mangle good data.
|
|
55
|
+
export function normalizeErrorResult(result) {
|
|
56
|
+
const first = result.content?.[0];
|
|
57
|
+
if (!first || first.type !== "text" || typeof first.text !== "string") {
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
const raw = first.text.trim();
|
|
61
|
+
let parsed = null;
|
|
62
|
+
if (raw.startsWith("{")) {
|
|
63
|
+
try {
|
|
64
|
+
const candidate = JSON.parse(raw);
|
|
65
|
+
if (candidate &&
|
|
66
|
+
typeof candidate === "object" &&
|
|
67
|
+
!Array.isArray(candidate)) {
|
|
68
|
+
parsed = candidate;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
parsed = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (parsed) {
|
|
76
|
+
// Already JSON. Add hint if missing; preserve any extra fields the tool
|
|
77
|
+
// attached (e.g. upsert_process attaches partialApply/failedStep).
|
|
78
|
+
const code = parsed.code ?? DEFAULT_CODE;
|
|
79
|
+
const enriched = {
|
|
80
|
+
...parsed,
|
|
81
|
+
code,
|
|
82
|
+
// Payload fields are preserved via the spread — falling back to `raw`
|
|
83
|
+
// here would duplicate the entire JSON body inside `message`.
|
|
84
|
+
message: parsed.message ??
|
|
85
|
+
"Tool reported an error — see the payload fields for detail.",
|
|
86
|
+
hint: parsed.hint ?? hintForCode(code),
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
isError: true,
|
|
90
|
+
content: [{ type: "text", text: JSON.stringify(enriched) }],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// Plain-text error body — wrap into uniform shape.
|
|
94
|
+
const stripped = raw.replace(/^TM1 error:\s*/i, "");
|
|
95
|
+
const payload = {
|
|
96
|
+
code: DEFAULT_CODE,
|
|
97
|
+
message: stripped,
|
|
98
|
+
hint: hintForCode(DEFAULT_CODE),
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
isError: true,
|
|
102
|
+
content: [{ type: "text", text: JSON.stringify(payload) }],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// Attach a tool-context hint to any thrown error and rethrow.
|
|
106
|
+
// Use to wrap an awaited TM1 call so failures carry a tool-specific
|
|
107
|
+
// follow-up suggestion instead of just the generic code-derived hint.
|
|
108
|
+
//
|
|
109
|
+
// Example:
|
|
110
|
+
// await withToolHint(
|
|
111
|
+
// tm1Client.cubes.setRules(cube, rules),
|
|
112
|
+
// "Validate first with tm1_check_cube_rule before tm1_set_cube_rules.",
|
|
113
|
+
// );
|
|
114
|
+
export async function withToolHint(p, hint) {
|
|
115
|
+
try {
|
|
116
|
+
return await p;
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
if (err instanceof TM1Error) {
|
|
120
|
+
err.hintOverride = hint;
|
|
121
|
+
throw err;
|
|
122
|
+
}
|
|
123
|
+
throw new TM1Error({
|
|
124
|
+
code: DEFAULT_CODE,
|
|
125
|
+
message: err instanceof Error ? err.message : String(err),
|
|
126
|
+
hint,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=error-format.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { withToolHint } from "../error-format.js";
|
|
3
|
+
import { CONFIRM_SCHEMA, requireConfirm } from "../confirm.js";
|
|
4
|
+
import { actionResponse } from "../format.js";
|
|
5
|
+
import { DESTRUCTIVE } from "../annotations.js";
|
|
6
|
+
import { MutationResultSchema } from "../schemas/items.js";
|
|
7
|
+
import { defineTool } from "../define-tool.js";
|
|
8
|
+
export const registerDeleteFile = defineTool({
|
|
9
|
+
name: "tm1_delete_file",
|
|
10
|
+
description: [
|
|
11
|
+
"Delete a file from the TM1 server's blob/file storage.",
|
|
12
|
+
"Irreversible — file is removed from Files/Blobs container.",
|
|
13
|
+
"Auto-falls back from v12 (Files) to v11 (Blobs).",
|
|
14
|
+
"Returns NOT_FOUND if file is missing in both containers.",
|
|
15
|
+
"Safety: pass confirm=<file name verbatim>.",
|
|
16
|
+
],
|
|
17
|
+
annotations: DESTRUCTIVE,
|
|
18
|
+
output: MutationResultSchema,
|
|
19
|
+
input: {
|
|
20
|
+
fileName: z
|
|
21
|
+
.string()
|
|
22
|
+
.min(1)
|
|
23
|
+
.describe("File name or path (e.g. 'data.csv' or 'imports/old.csv')."),
|
|
24
|
+
...CONFIRM_SCHEMA,
|
|
25
|
+
},
|
|
26
|
+
handler: async ({ fileName, confirm }, tm1Client) => {
|
|
27
|
+
requireConfirm(confirm, fileName, "file");
|
|
28
|
+
await withToolHint(tm1Client.files.delete(fileName), "Verify exact name with tm1_list_files or tm1_search_files. Names are case-sensitive.");
|
|
29
|
+
return actionResponse({ success: true, fileName, deleted: true });
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=delete-file.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { FileContentResultSchema } from "../schemas/items.js";
|
|
3
|
+
import { READ_ONLY } from "../annotations.js";
|
|
4
|
+
import { defineTool } from "../define-tool.js";
|
|
5
|
+
// Below the server's 80k-character response limit (TM1_MAX_RESPONSE_CHARS)
|
|
6
|
+
// once JSON escaping is added; the old 256 KB default could never be returned.
|
|
7
|
+
const DEFAULT_MAX_BYTES = 64 * 1024;
|
|
8
|
+
const HARD_MAX_BYTES = 4 * 1024 * 1024;
|
|
9
|
+
export const registerGetFileContent = defineTool({
|
|
10
|
+
name: "tm1_get_file_content",
|
|
11
|
+
description: [
|
|
12
|
+
"Read the content of a file from the TM1 server's data directory.",
|
|
13
|
+
"Use to inspect CSV, TXT, or other text files before building import processes.",
|
|
14
|
+
"Auto-falls back from v12 (Files) to v11 (Blobs) container.",
|
|
15
|
+
"Response is truncated to maxBytes (default 64 KB) to keep MCP messages small.",
|
|
16
|
+
],
|
|
17
|
+
annotations: READ_ONLY,
|
|
18
|
+
output: FileContentResultSchema,
|
|
19
|
+
input: {
|
|
20
|
+
fileName: z
|
|
21
|
+
.string()
|
|
22
|
+
.describe("File name or path (e.g. 'data.csv' or 'imports/sales_2024.csv')"),
|
|
23
|
+
maxBytes: z
|
|
24
|
+
.number()
|
|
25
|
+
.int()
|
|
26
|
+
.positive()
|
|
27
|
+
.max(HARD_MAX_BYTES)
|
|
28
|
+
.optional()
|
|
29
|
+
.default(DEFAULT_MAX_BYTES)
|
|
30
|
+
.describe(`Truncate response after N bytes (default ${DEFAULT_MAX_BYTES}, hard max ${HARD_MAX_BYTES}).`),
|
|
31
|
+
headLines: z
|
|
32
|
+
.number()
|
|
33
|
+
.int()
|
|
34
|
+
.positive()
|
|
35
|
+
.max(10000)
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("If set, only return the first N lines (overrides byte truncation)."),
|
|
38
|
+
},
|
|
39
|
+
handler: async ({ fileName, maxBytes, headLines }, tm1Client) => {
|
|
40
|
+
const content = await tm1Client.files.getContent(fileName);
|
|
41
|
+
const totalBytes = Buffer.byteLength(content, "utf8");
|
|
42
|
+
let body;
|
|
43
|
+
let truncated = false;
|
|
44
|
+
let truncationReason;
|
|
45
|
+
if (headLines !== undefined) {
|
|
46
|
+
const allLines = content.split("\n");
|
|
47
|
+
body = allLines.slice(0, headLines).join("\n");
|
|
48
|
+
if (allLines.length > headLines) {
|
|
49
|
+
truncated = true;
|
|
50
|
+
truncationReason = `headLines=${headLines} (of ${allLines.length})`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (totalBytes > maxBytes) {
|
|
54
|
+
body = Buffer.from(content, "utf8")
|
|
55
|
+
.subarray(0, maxBytes)
|
|
56
|
+
.toString("utf8");
|
|
57
|
+
truncated = true;
|
|
58
|
+
truncationReason = `maxBytes=${maxBytes}`;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
body = content;
|
|
62
|
+
}
|
|
63
|
+
const payload = {
|
|
64
|
+
fileName,
|
|
65
|
+
totalBytes,
|
|
66
|
+
returnedBytes: Buffer.byteLength(body, "utf8"),
|
|
67
|
+
truncated,
|
|
68
|
+
...(truncationReason ? { truncationReason } : {}),
|
|
69
|
+
content: body,
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
content: [{ type: "text", text: JSON.stringify(payload) }],
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=get-file-content.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PAGINATION_SCHEMA, paginate } from "../pagination.js";
|
|
3
|
+
import { FORMAT_SCHEMA, wrappedPageResponse, columnsOf } from "../format.js";
|
|
4
|
+
import { READ_ONLY } from "../annotations.js";
|
|
5
|
+
import { defineTool } from "../define-tool.js";
|
|
6
|
+
import { FilenameItemSchema } from "../schemas/items.js";
|
|
7
|
+
import { pageShapeFor } from "../schemas/common.js";
|
|
8
|
+
// tm1_list_files prefixes a `path` field on top of the page envelope.
|
|
9
|
+
const filePageShape = {
|
|
10
|
+
path: z.string().describe("Path that was listed (echoes the input)"),
|
|
11
|
+
...pageShapeFor(FilenameItemSchema),
|
|
12
|
+
};
|
|
13
|
+
export const registerListFiles = defineTool({
|
|
14
|
+
name: "tm1_list_files",
|
|
15
|
+
description: [
|
|
16
|
+
"List files in the TM1 server's data directory (blob/file storage).",
|
|
17
|
+
"Use to browse available CSV, TXT, or other files before building import processes.",
|
|
18
|
+
"Supports subfolder navigation via the path parameter.",
|
|
19
|
+
"Auto-falls back from v12 (Files) to v11 (Blobs) container.",
|
|
20
|
+
"Paginated (default 50/page).",
|
|
21
|
+
],
|
|
22
|
+
annotations: READ_ONLY,
|
|
23
|
+
output: filePageShape,
|
|
24
|
+
input: {
|
|
25
|
+
path: z
|
|
26
|
+
.string()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("Subfolder path (e.g. 'imports' or 'imports/2024'). Empty = root."),
|
|
29
|
+
...PAGINATION_SCHEMA,
|
|
30
|
+
...FORMAT_SCHEMA,
|
|
31
|
+
},
|
|
32
|
+
handler: async ({ path, limit, offset, fetchAll, format }, tm1Client) => {
|
|
33
|
+
const files = await tm1Client.files.list(path);
|
|
34
|
+
const page = paginate(files, limit, offset, fetchAll);
|
|
35
|
+
const wrapper = { path: path ?? "", ...page };
|
|
36
|
+
const columns = columnsOf([{ header: "filename", get: (f) => f }]);
|
|
37
|
+
return wrappedPageResponse(wrapper, page, format, {
|
|
38
|
+
title: `Files in /${path ?? ""}`,
|
|
39
|
+
columns,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=list-files.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PAGINATION_SCHEMA, paginate } from "../pagination.js";
|
|
3
|
+
import { FORMAT_SCHEMA, wrappedPageResponse, columnsOf } from "../format.js";
|
|
4
|
+
import { READ_ONLY } from "../annotations.js";
|
|
5
|
+
import { defineTool } from "../define-tool.js";
|
|
6
|
+
import { FilenameItemSchema } from "../schemas/items.js";
|
|
7
|
+
import { pageShapeFor } from "../schemas/common.js";
|
|
8
|
+
// tm1_search_files echoes the search filters alongside the page envelope so
|
|
9
|
+
// callers can correlate matches with the request that produced them.
|
|
10
|
+
const searchFilePageShape = {
|
|
11
|
+
path: z.string().describe("Folder that was searched (echoes the input)"),
|
|
12
|
+
startswith: z.string().nullable().describe("Prefix filter applied, or null"),
|
|
13
|
+
contains: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.nullable()
|
|
16
|
+
.describe("Substring filters applied, or null"),
|
|
17
|
+
operator: z
|
|
18
|
+
.enum(["and", "or"])
|
|
19
|
+
.describe("How `contains` substrings were joined"),
|
|
20
|
+
...pageShapeFor(FilenameItemSchema),
|
|
21
|
+
};
|
|
22
|
+
export const registerSearchFiles = defineTool({
|
|
23
|
+
name: "tm1_search_files",
|
|
24
|
+
description: [
|
|
25
|
+
"Search file names in the TM1 server's blob/file storage by prefix and/or substring.",
|
|
26
|
+
"Use to find files when you only know part of the name (case-insensitive).",
|
|
27
|
+
"Combines startswith and contains filters via the `operator` (and/or).",
|
|
28
|
+
"Auto-falls back from v12 (Files) to v11 (Blobs) container.",
|
|
29
|
+
"Paginated (default 50/page).",
|
|
30
|
+
],
|
|
31
|
+
annotations: READ_ONLY,
|
|
32
|
+
output: searchFilePageShape,
|
|
33
|
+
input: {
|
|
34
|
+
startswith: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("Case-insensitive prefix match on the file name (e.g. 'sales_')."),
|
|
38
|
+
contains: z
|
|
39
|
+
.array(z.string())
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("List of case-insensitive substrings the name must contain (joined by `operator`)."),
|
|
42
|
+
operator: z
|
|
43
|
+
.enum(["and", "or"])
|
|
44
|
+
.optional()
|
|
45
|
+
.default("and")
|
|
46
|
+
.describe("How to join multiple `contains` substrings. Default 'and'."),
|
|
47
|
+
path: z
|
|
48
|
+
.string()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe("Subfolder to search in (v12 only). Empty = root."),
|
|
51
|
+
...PAGINATION_SCHEMA,
|
|
52
|
+
...FORMAT_SCHEMA,
|
|
53
|
+
},
|
|
54
|
+
handler: async ({ startswith, contains, operator, path, limit, offset, fetchAll, format }, tm1Client) => {
|
|
55
|
+
const names = await tm1Client.files.search({
|
|
56
|
+
startswith,
|
|
57
|
+
contains,
|
|
58
|
+
operator,
|
|
59
|
+
path,
|
|
60
|
+
});
|
|
61
|
+
const page = paginate(names, limit, offset, fetchAll);
|
|
62
|
+
const wrapper = {
|
|
63
|
+
path: path ?? "",
|
|
64
|
+
startswith: startswith ?? null,
|
|
65
|
+
contains: contains ?? null,
|
|
66
|
+
operator,
|
|
67
|
+
...page,
|
|
68
|
+
};
|
|
69
|
+
const columns = columnsOf([{ header: "filename", get: (f) => f }]);
|
|
70
|
+
return wrappedPageResponse(wrapper, page, format, {
|
|
71
|
+
title: `File search results in /${path ?? ""}`,
|
|
72
|
+
columns,
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=search-files.js.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { withToolHint } from "../error-format.js";
|
|
3
|
+
import { actionResponse } from "../format.js";
|
|
4
|
+
import { CONFIRM_SCHEMA, requireConfirm } from "../confirm.js";
|
|
5
|
+
import { IDEMPOTENT_WRITE } from "../annotations.js";
|
|
6
|
+
import { MutationResultSchema } from "../schemas/items.js";
|
|
7
|
+
import { defineTool } from "../define-tool.js";
|
|
8
|
+
const HARD_MAX_BYTES = 32 * 1024 * 1024;
|
|
9
|
+
export const registerUploadFile = defineTool({
|
|
10
|
+
name: "tm1_upload_file",
|
|
11
|
+
description: [
|
|
12
|
+
"Upload (create or update) a file in the TM1 server's blob/file storage.",
|
|
13
|
+
"Use to push CSV, TXT, or other data files that import processes will read.",
|
|
14
|
+
"Provide content as plain text OR base64 (set encoding='base64' for binary).",
|
|
15
|
+
"Auto-falls back from v12 (Files) to v11 (Blobs) container.",
|
|
16
|
+
"v11: subfolders not supported — use a flat file name. v12: nested paths OK if folders exist.",
|
|
17
|
+
`Hard max size: ${HARD_MAX_BYTES} bytes (32 MB).`,
|
|
18
|
+
],
|
|
19
|
+
annotations: IDEMPOTENT_WRITE,
|
|
20
|
+
output: MutationResultSchema,
|
|
21
|
+
input: {
|
|
22
|
+
fileName: z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.describe("File name or path (e.g. 'data.csv' or 'imports/sales_2024.csv'). v11 = flat only."),
|
|
26
|
+
content: z
|
|
27
|
+
.string()
|
|
28
|
+
.describe("File content. Plain text by default, or base64 string when encoding='base64'."),
|
|
29
|
+
encoding: z
|
|
30
|
+
.enum(["text", "base64"])
|
|
31
|
+
.optional()
|
|
32
|
+
.default("text")
|
|
33
|
+
.describe("Encoding of the `content` field. 'text' (default) for UTF-8 text, 'base64' for binary."),
|
|
34
|
+
...CONFIRM_SCHEMA,
|
|
35
|
+
},
|
|
36
|
+
handler: async ({ fileName, content, encoding, confirm }, tm1Client) => {
|
|
37
|
+
// Silently replaces an existing server file of the same name. Guards
|
|
38
|
+
// against accidental invocation — not a security control.
|
|
39
|
+
requireConfirm(confirm, fileName, "file");
|
|
40
|
+
const bytes = encoding === "base64"
|
|
41
|
+
? Buffer.from(content, "base64")
|
|
42
|
+
: Buffer.from(content, "utf8");
|
|
43
|
+
if (bytes.byteLength > HARD_MAX_BYTES) {
|
|
44
|
+
return {
|
|
45
|
+
isError: true,
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
type: "text",
|
|
49
|
+
text: JSON.stringify({
|
|
50
|
+
code: "VALIDATION_ERROR",
|
|
51
|
+
message: `File too large: ${bytes.byteLength} bytes (hard max ${HARD_MAX_BYTES})`,
|
|
52
|
+
hint: "Split the file or upload a smaller subset. Multipart upload is not yet supported.",
|
|
53
|
+
}, null, 2),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const result = await withToolHint(tm1Client.files.upload(fileName, bytes), "If parent folder is missing, create it on TM1 v12 before retrying. v11 supports root only.");
|
|
59
|
+
return actionResponse({
|
|
60
|
+
success: true,
|
|
61
|
+
fileName,
|
|
62
|
+
bytesUploaded: bytes.byteLength,
|
|
63
|
+
created: result.created,
|
|
64
|
+
updated: !result.created,
|
|
65
|
+
container: result.root,
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=upload-file.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Page } from "./pagination.js";
|
|
3
|
+
export declare const FORMAT_SCHEMA: {
|
|
4
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
markdown: "markdown";
|
|
6
|
+
json: "json";
|
|
7
|
+
}>>>;
|
|
8
|
+
};
|
|
9
|
+
export type ResponseFormat = "json" | "markdown";
|
|
10
|
+
export interface Column<T> {
|
|
11
|
+
header: string;
|
|
12
|
+
get: (row: T) => unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A column is either a field name — rendered as itself, under its own name —
|
|
16
|
+
* or a full {header, get} pair for the cases that need one (a header that
|
|
17
|
+
* differs from the field, a projection, a computed value).
|
|
18
|
+
*/
|
|
19
|
+
export type ColumnSpec<T> = (keyof T & string) | Column<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Build the column list for a Markdown table.
|
|
22
|
+
*
|
|
23
|
+
* Most columns just print a field, and writing that out per column meant ~100
|
|
24
|
+
* `{ header: "name", get: (r) => r.name }` literals across the tool files, none
|
|
25
|
+
* of which the compiler could tie back to the row type — a renamed field left a
|
|
26
|
+
* table quietly printing empty cells. Naming the field instead makes the key
|
|
27
|
+
* `keyof Row`, so the rename becomes a compile error.
|
|
28
|
+
*
|
|
29
|
+
* `(r) => r.field ?? ""` is deliberately NOT needed: renderTable's escaper
|
|
30
|
+
* already prints null/undefined as an empty cell, and `??` leaves 0/false
|
|
31
|
+
* untouched, so the plain field name renders identically.
|
|
32
|
+
*/
|
|
33
|
+
export declare function columnsOf<T>(specs: readonly ColumnSpec<T>[]): Column<T>[];
|
|
34
|
+
export declare function renderKV(obj: Record<string, unknown>, title?: string): string;
|
|
35
|
+
export declare function renderTable<T>(rows: readonly T[], columns: Column<T>[]): string;
|
|
36
|
+
export interface PageRenderOpts<T> {
|
|
37
|
+
title: string;
|
|
38
|
+
columns: Column<T>[];
|
|
39
|
+
}
|
|
40
|
+
export declare function renderPage<T>(page: Page<T>, opts: PageRenderOpts<T>): string;
|
|
41
|
+
interface TextResult {
|
|
42
|
+
[x: string]: unknown;
|
|
43
|
+
content: Array<{
|
|
44
|
+
type: "text";
|
|
45
|
+
text: string;
|
|
46
|
+
}>;
|
|
47
|
+
structuredContent?: {
|
|
48
|
+
[k: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare function markdownResult(markdown: string): TextResult;
|
|
52
|
+
export declare function pageResponse<T>(page: Page<T>, format: ResponseFormat, opts: PageRenderOpts<T>): TextResult;
|
|
53
|
+
export declare function wrappedPageResponse<T>(wrapper: object, page: Page<T>, format: ResponseFormat, opts: PageRenderOpts<T>): TextResult;
|
|
54
|
+
export declare function payloadResponse<T>(payload: T, format: ResponseFormat, renderMarkdown: (p: T) => string): TextResult;
|
|
55
|
+
export declare function actionResponse<T extends object>(payload: T): TextResult;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Shared response-format helper for list_* tools (G1 from MCP best-practices
|
|
2
|
+
// review). Adds a `format: "json"|"markdown"` param so agents get structured
|
|
3
|
+
// JSON (default, parsed by Proxy into structuredContent) while humans get a
|
|
4
|
+
// readable Markdown table when piped to chat output.
|
|
5
|
+
//
|
|
6
|
+
// The markdown payload travels BOTH ways: as the text block (read by clients
|
|
7
|
+
// like Kiro) and as `structuredContent: { markdown }` (read by clients like
|
|
8
|
+
// Claude Code, which discard `content` whenever structuredContent is present).
|
|
9
|
+
// Shipping it only one way makes format:"markdown" a no-op on one of them.
|
|
10
|
+
// defineTool() applies `markdownCapable()` automatically to any tool whose
|
|
11
|
+
// input shape carries `format` — see ./schemas/markdown-capable.ts for the why.
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
// Terse by design — see the byte-cost note on PAGINATION_SCHEMA. The enum
|
|
14
|
+
// members and the "json" default are emitted structurally by JSON Schema, so
|
|
15
|
+
// the description only carries what they cannot: what picking "markdown" does.
|
|
16
|
+
export const FORMAT_SCHEMA = {
|
|
17
|
+
format: z
|
|
18
|
+
.enum(["json", "markdown"])
|
|
19
|
+
.optional()
|
|
20
|
+
.default("json")
|
|
21
|
+
.describe("'markdown' = human-readable table."),
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Build the column list for a Markdown table.
|
|
25
|
+
*
|
|
26
|
+
* Most columns just print a field, and writing that out per column meant ~100
|
|
27
|
+
* `{ header: "name", get: (r) => r.name }` literals across the tool files, none
|
|
28
|
+
* of which the compiler could tie back to the row type — a renamed field left a
|
|
29
|
+
* table quietly printing empty cells. Naming the field instead makes the key
|
|
30
|
+
* `keyof Row`, so the rename becomes a compile error.
|
|
31
|
+
*
|
|
32
|
+
* `(r) => r.field ?? ""` is deliberately NOT needed: renderTable's escaper
|
|
33
|
+
* already prints null/undefined as an empty cell, and `??` leaves 0/false
|
|
34
|
+
* untouched, so the plain field name renders identically.
|
|
35
|
+
*/
|
|
36
|
+
export function columnsOf(specs) {
|
|
37
|
+
return specs.map((spec) => typeof spec === "string"
|
|
38
|
+
? { header: spec, get: (row) => row[spec] }
|
|
39
|
+
: spec);
|
|
40
|
+
}
|
|
41
|
+
function mdEscape(v) {
|
|
42
|
+
if (v === null || v === undefined)
|
|
43
|
+
return "";
|
|
44
|
+
const s = typeof v === "string"
|
|
45
|
+
? v
|
|
46
|
+
: Array.isArray(v)
|
|
47
|
+
? v.join(", ")
|
|
48
|
+
: typeof v === "object"
|
|
49
|
+
? JSON.stringify(v)
|
|
50
|
+
: String(v);
|
|
51
|
+
return s.replace(/\|/g, "\\|").replace(/\n/g, " ").replace(/\r/g, "");
|
|
52
|
+
}
|
|
53
|
+
// Render an object as a 2-column key/value Markdown table.
|
|
54
|
+
// Nested objects become indented sub-tables; scalars stringify directly.
|
|
55
|
+
export function renderKV(obj, title) {
|
|
56
|
+
const lines = [];
|
|
57
|
+
if (title)
|
|
58
|
+
lines.push(`## ${title}`, "");
|
|
59
|
+
lines.push("| key | value |", "| --- | --- |");
|
|
60
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
61
|
+
if (v === null || v === undefined) {
|
|
62
|
+
lines.push(`| ${k} | _(none)_ |`);
|
|
63
|
+
}
|
|
64
|
+
else if (Array.isArray(v)) {
|
|
65
|
+
lines.push(`| ${k} | ${mdEscape(v)} |`);
|
|
66
|
+
}
|
|
67
|
+
else if (typeof v === "object") {
|
|
68
|
+
lines.push(`| **${k}** | _(see below)_ |`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
lines.push(`| ${k} | ${mdEscape(v)} |`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
75
|
+
if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
76
|
+
lines.push("", `### ${k}`, "");
|
|
77
|
+
lines.push("| key | value |", "| --- | --- |");
|
|
78
|
+
for (const [k2, v2] of Object.entries(v)) {
|
|
79
|
+
lines.push(`| ${k2} | ${mdEscape(v2)} |`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return lines.join("\n");
|
|
84
|
+
}
|
|
85
|
+
export function renderTable(rows, columns) {
|
|
86
|
+
if (rows.length === 0)
|
|
87
|
+
return "_(no rows)_";
|
|
88
|
+
const headers = columns.map((c) => c.header);
|
|
89
|
+
const lines = [
|
|
90
|
+
`| ${headers.join(" | ")} |`,
|
|
91
|
+
`| ${headers.map(() => "---").join(" | ")} |`,
|
|
92
|
+
...rows.map((row) => `| ${columns.map((c) => mdEscape(c.get(row))).join(" | ")} |`),
|
|
93
|
+
];
|
|
94
|
+
return lines.join("\n");
|
|
95
|
+
}
|
|
96
|
+
export function renderPage(page, opts) {
|
|
97
|
+
const meta = `${page.total} total · ${page.count} shown · offset ${page.offset}${page.has_more ? ` · next_offset ${page.next_offset}` : ""}`;
|
|
98
|
+
const table = renderTable(page.items, opts.columns);
|
|
99
|
+
return `## ${opts.title}\n\n${meta}\n\n${table}`;
|
|
100
|
+
}
|
|
101
|
+
// The rendered table goes out twice on purpose: once as the text block, once
|
|
102
|
+
// as structuredContent. Which of the two a client reads is not negotiable from
|
|
103
|
+
// here — Kiro renders `content` and ignores structuredContent, Claude Code
|
|
104
|
+
// does the reverse — so a markdown response that fills only one of them is
|
|
105
|
+
// invisible on the other client. The JSON payload is deliberately NOT included
|
|
106
|
+
// alongside: a client that reads structuredContent would then be shown the
|
|
107
|
+
// JSON it asked not to get, which is exactly the bug this replaces.
|
|
108
|
+
export function markdownResult(markdown) {
|
|
109
|
+
return {
|
|
110
|
+
content: [{ type: "text", text: markdown }],
|
|
111
|
+
structuredContent: { markdown },
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// Page payload as either JSON (default, Proxy → structuredContent) or
|
|
115
|
+
// Markdown table (for human display).
|
|
116
|
+
export function pageResponse(page, format, opts) {
|
|
117
|
+
if (format === "markdown") {
|
|
118
|
+
return markdownResult(renderPage(page, opts));
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
content: [{ type: "text", text: JSON.stringify(page) }],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// Same as pageResponse but for tools that wrap the page envelope with extra
|
|
125
|
+
// top-level fields (e.g. list_files prepends `path`). The wrapper object is
|
|
126
|
+
// only used for the JSON path; the Markdown table is rendered from the inner
|
|
127
|
+
// page so the metadata line stays consistent.
|
|
128
|
+
export function wrappedPageResponse(wrapper, page, format, opts) {
|
|
129
|
+
if (format === "markdown") {
|
|
130
|
+
return markdownResult(renderPage(page, opts));
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
content: [{ type: "text", text: JSON.stringify(wrapper) }],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
// Generic JSON-or-Markdown response for non-paginated payloads.
|
|
137
|
+
// Caller supplies a markdown renderer that gets the typed payload.
|
|
138
|
+
export function payloadResponse(payload, format, renderMarkdown) {
|
|
139
|
+
if (format === "markdown") {
|
|
140
|
+
return markdownResult(renderMarkdown(payload));
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
content: [{ type: "text", text: JSON.stringify(payload) }],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// Action-result helper for non-paginated mutation tools (delete/clear/
|
|
147
|
+
// toggle/etc.) that return a flat {success, ...meta} payload. JSON-only;
|
|
148
|
+
// no markdown variant since one-liner action results don't benefit from a
|
|
149
|
+
// table view. structuredContent is attached so the declared-schema roundtrip
|
|
150
|
+
// is satisfied without the Proxy re-parsing the JSON body.
|
|
151
|
+
export function actionResponse(payload) {
|
|
152
|
+
return {
|
|
153
|
+
content: [{ type: "text", text: JSON.stringify(payload) }],
|
|
154
|
+
structuredContent: payload,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const HIERARCHY_NAME_OPTIONAL: {
|
|
3
|
+
hierarchyName: z.ZodOptional<z.ZodString>;
|
|
4
|
+
};
|
|
5
|
+
export declare function resolveHierarchy(dimensionName: string, hierarchyName: string | undefined): string;
|
|
6
|
+
//# sourceMappingURL=hierarchy.d.ts.map
|