@W-21748754: Add tools for retrieving data and images for custom views#285
@W-21748754: Add tools for retrieving data and images for custom views#285anyoung-tableau wants to merge 22 commits intomainfrom
Conversation
…e' into anyoung/custom-views
There was a problem hiding this comment.
Pull request overview
This PR adds support for retrieving Tableau Custom View data (CSV) and images (PNG) via new MCP tools, including authorization gating and docs/tests updates.
Changes:
- Added new MCP tools:
get-custom-view-dataandget-custom-view-image, plus OAuth scope mapping and tool registry wiring. - Extended bounded-context authorization to support custom views by resolving to the underlying published view (
ResourceAccessChecker.isCustomViewAllowed). - Updated test fixtures and added/updated e2e + oauth tests and documentation for the new tools.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/oauth/tableau-authz/tests/listWorkbooks.test.ts | Adjusts workbook assertions to align with updated fixture shape. |
| tests/oauth/tableau-authz/tests/getWorkbook.test.ts | Adjusts workbook assertions to align with updated fixture shape. |
| tests/oauth/tableau-authz/tests/getViewImage.test.ts | Updates view id lookup to use defaultView.id. |
| tests/oauth/tableau-authz/tests/getViewData.test.ts | Updates view id lookup to use defaultView.id. |
| tests/oauth/tableau-authz/tests/getCustomViewImage.test.ts | Adds authz test for custom view image tool. |
| tests/oauth/tableau-authz/tests/getCustomViewData.test.ts | Adds authz test for custom view data tool. |
| tests/e2e/workbooks/listWorkbooks.test.ts | Updates workbook assertions to use defaultView.id. |
| tests/e2e/workbooks/getWorkbook.test.ts | Updates workbook assertions to use defaultView.id. |
| tests/e2e/views/listViews.test.ts | Updates view id comparisons to use defaultView.id. |
| tests/e2e/views/getViewImage.test.ts | Updates tool args to use defaultView.id. |
| tests/e2e/views/getViewData.test.ts | Updates tool args to use defaultView.id. |
| tests/e2e/views/getCustomViewImage.test.ts | Adds e2e test coverage for custom view image retrieval. |
| tests/e2e/views/getCustomViewData.test.ts | Adds e2e test coverage for custom view data retrieval. |
| tests/constants.ts | Updates Superstore workbook fixture to include defaultView: { id, customViewId }. |
| src/tools/views/mockCustomView.ts | Adds mock CustomView fixture for unit tests. |
| src/tools/views/getViewImage.test.ts | Fixes PNG binary/base64 handling in unit tests (latin1/base64). |
| src/tools/views/getCustomViewImage.ts | Implements get-custom-view-image MCP tool. |
| src/tools/views/getCustomViewImage.test.ts | Adds unit tests for get-custom-view-image. |
| src/tools/views/getCustomViewData.ts | Implements get-custom-view-data MCP tool. |
| src/tools/views/getCustomViewData.test.ts | Adds unit tests for get-custom-view-data. |
| src/tools/tools.ts | Registers new tools in the tool factory list. |
| src/tools/toolName.ts | Adds new tool names and includes them in the view tool group. |
| src/tools/resourceAccessChecker.ts | Adds custom view authorization via underlying published view resolution + caching. |
| src/tools/resourceAccessChecker.test.ts | Adds test coverage for isCustomViewAllowed. |
| src/tools/convertPngDataToToolResult.ts | Ensures PNG base64 encoding preserves bytes via latin1. |
| src/server/oauth/scopes.ts | Adds OAuth scope requirements for the new tools. |
| src/sdks/tableau/types/customView.ts | Adds CustomView type/schema for REST responses. |
| src/sdks/tableau/methods/viewsMethods.ts | Adds REST methods: getCustomView, getCustomViewData, getCustomViewImage. |
| src/sdks/tableau/apis/viewsApi.ts | Adds REST endpoints: getCustomView, getCustomViewData, getCustomViewImage. |
| src/errors/mcpToolError.ts | Adds CustomViewNotAllowedError (403). |
| mcp.docker.cursor.example.json | Adds Cursor docker MCP server example config. |
| docs/docs/tools/views/get-custom-view-image.md | Adds documentation for get-custom-view-image. |
| docs/docs/tools/views/get-custom-view-data.md | Adds documentation for get-custom-view-data. |
| docs/docs/intro.md | Updates tool list and references to include the new tools. |
| .cursor/rules/tableau-mcp.mdc | Updates internal tool registry count/list for Cursor rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| viewFilters: z | ||
| .record(z.string()) | ||
| .optional() | ||
| .describe('Optional map of view filter field names to values.'), |
There was a problem hiding this comment.
Driveby updates to get-view-data and get-view-image tools to include the view filters to be in sync with the Custom View tools.
| if (response.params && Object.keys(response.params).length > 0) { | ||
| url.search = new URLSearchParams(response.params).toString(); |
There was a problem hiding this comment.
Driveby fix here. This was wrong before and the query params weren't included in the response traces.
| ): Omit<ResponseInterceptorConfig, 'baseUrl'> { | ||
| return { | ||
| url: response.config.url ?? 'UNKNOWN URL', | ||
| params: response.config.params, |
There was a problem hiding this comment.
Driveby fix here to ensure the response interceptor includes the URL search params in the trace.
| # Configuring Tableau | ||
|
|
||
| Tableau MCP works with both Tableau Server and Tableau Cloud data with these prerequisites: | ||
| Tableau MCP works with both Tableau Server 2024.2+ and Tableau Cloud data with these prerequisites: |
There was a problem hiding this comment.
I added the min Server version here because the Get Custom View Image REST API was only added in 2023.1 and someone trying to use it against an older Server version would see errors. 2024.2 is a min bar anyway (mostly driven by VDS compatibility)
No description provided.