diff --git a/src/server/oauth/scopes.ts b/src/server/oauth/scopes.ts index 830203e3a..a17e0425c 100644 --- a/src/server/oauth/scopes.ts +++ b/src/server/oauth/scopes.ts @@ -243,11 +243,11 @@ const toolScopeMap: Record< mcp: ['tableau:mcp:pulse:read'], api: new Set(['tableau:insight_definitions_metrics:read', 'tableau:mcp_site_settings:read']), }, - 'list-pulse-metric-definitions-from-definition-ids': { + 'list-pulse-metric-definitions': { mcp: ['tableau:mcp:pulse:read'], api: new Set(['tableau:insight_definitions_metrics:read', 'tableau:mcp_site_settings:read']), }, - 'list-pulse-metrics-from-metric-definition-id': { + 'list-pulse-metrics-from-definition-id': { mcp: ['tableau:mcp:pulse:read'], api: new Set(['tableau:insight_definitions_metrics:read', 'tableau:mcp_site_settings:read']), }, @@ -265,7 +265,7 @@ const toolScopeMap: Record< 'tableau:mcp_site_settings:read', ]), }, - 'generate-pulse-metric-value-insight-bundle': { + 'generate-pulse-insight-bundle': { mcp: ['tableau:mcp:insight:create'], api: new Set(['tableau:insights:read', 'tableau:mcp_site_settings:read']), }, diff --git a/src/tools/web/pulse/generateMetricValueInsightBundle/generatePulseMetricValueInsightBundleTool.test.ts b/src/tools/web/pulse/generateMetricValueInsightBundle/generatePulseMetricValueInsightBundleTool.test.ts index 2e666f1d9..2f41ed8f1 100644 --- a/src/tools/web/pulse/generateMetricValueInsightBundle/generatePulseMetricValueInsightBundleTool.test.ts +++ b/src/tools/web/pulse/generateMetricValueInsightBundle/generatePulseMetricValueInsightBundleTool.test.ts @@ -176,7 +176,7 @@ describe('getGeneratePulseMetricValueInsightBundleTool', () => { it('should have correct tool properties', () => { const tool = getGeneratePulseMetricValueInsightBundleTool(new WebMcpServer()); - expect(tool.name).toBe('generate-pulse-metric-value-insight-bundle'); + expect(tool.name).toBe('generate-pulse-insight-bundle'); expect(tool.description).toContain( 'Generate an insight bundle for the current aggregated value', ); diff --git a/src/tools/web/pulse/generateMetricValueInsightBundle/generatePulseMetricValueInsightBundleTool.ts b/src/tools/web/pulse/generateMetricValueInsightBundle/generatePulseMetricValueInsightBundleTool.ts index fc507cbcb..e1fa3b297 100644 --- a/src/tools/web/pulse/generateMetricValueInsightBundle/generatePulseMetricValueInsightBundleTool.ts +++ b/src/tools/web/pulse/generateMetricValueInsightBundle/generatePulseMetricValueInsightBundleTool.ts @@ -22,7 +22,7 @@ export const getGeneratePulseMetricValueInsightBundleTool = ( ): WebTool => { const generatePulseMetricValueInsightBundleTool = new WebTool({ server, - name: 'generate-pulse-metric-value-insight-bundle', + name: 'generate-pulse-insight-bundle', description: ` Generate an insight bundle for the current aggregated value for Pulse Metric using Tableau REST API. You need the full information of the Pulse Metric and Pulse Metric Definition to use this tool. diff --git a/src/tools/web/pulse/listMetricDefinitionsFromDefinitionIds/listPulseMetricDefinitionsFromDefinitionIds.test.ts b/src/tools/web/pulse/listMetricDefinitionsFromDefinitionIds/listPulseMetricDefinitionsFromDefinitionIds.test.ts index 0702ddcca..69a7f17c8 100644 --- a/src/tools/web/pulse/listMetricDefinitionsFromDefinitionIds/listPulseMetricDefinitionsFromDefinitionIds.test.ts +++ b/src/tools/web/pulse/listMetricDefinitionsFromDefinitionIds/listPulseMetricDefinitionsFromDefinitionIds.test.ts @@ -34,7 +34,7 @@ describe('listPulseMetricDefinitionsFromDefinitionIdsTool', () => { const listPulseMetricDefinitionsFromDefinitionIdsTool = getListPulseMetricDefinitionsFromDefinitionIdsTool(new WebMcpServer()); expect(listPulseMetricDefinitionsFromDefinitionIdsTool.name).toBe( - 'list-pulse-metric-definitions-from-definition-ids', + 'list-pulse-metric-definitions', ); expect(listPulseMetricDefinitionsFromDefinitionIdsTool.description).toContain( 'Retrieves a list of specific Pulse Metric Definitions', @@ -121,7 +121,7 @@ describe('listPulseMetricDefinitionsFromDefinitionIdsTool', () => { mocks.mockListPulseMetricDefinitionsFromMetricDefinitionIds.mockRejectedValue({ errorCode: '-32602', message: - 'Invalid arguments for tool list-pulse-metric-definitions-from-definition-ids: Enumeration value must be one of: DEFINITION_VIEW_BASIC, DEFINITION_VIEW_FULL, DEFINITION_VIEW_DEFAULT "path": "view"', + 'Invalid arguments for tool list-pulse-metric-definitions: Enumeration value must be one of: DEFINITION_VIEW_BASIC, DEFINITION_VIEW_FULL, DEFINITION_VIEW_DEFAULT "path": "view"', }); // Intentionally passing invalid value for testing const result = await getToolResult({ @@ -140,7 +140,7 @@ describe('listPulseMetricDefinitionsFromDefinitionIdsTool', () => { it('should return an error for missing metricDefinitionIds', async () => { mocks.mockListPulseMetricDefinitionsFromMetricDefinitionIds.mockRejectedValue({ errorCode: '-32602', - message: `MCP error -32602: MCP error -32602: Invalid arguments for tool list-pulse-metric-definitions-from-definition-ids: [ + message: `MCP error -32602: MCP error -32602: Invalid arguments for tool list-pulse-metric-definitions: [ { "code": "too_small", "minimum": 1, @@ -165,7 +165,7 @@ describe('listPulseMetricDefinitionsFromDefinitionIdsTool', () => { it('should return an error for is metricDefinitionId is too small', async () => { mocks.mockListPulseMetricDefinitionsFromMetricDefinitionIds.mockRejectedValue({ errorCode: '-32602', - message: `MCP error -32602: MCP error -32602: Invalid arguments for tool list-pulse-metric-definitions-from-definition-ids: [ + message: `MCP error -32602: MCP error -32602: Invalid arguments for tool list-pulse-metric-definitions: [ { "code": "too_small", "minimum": 36, diff --git a/src/tools/web/pulse/listMetricDefinitionsFromDefinitionIds/listPulseMetricDefinitionsFromDefinitionIds.ts b/src/tools/web/pulse/listMetricDefinitionsFromDefinitionIds/listPulseMetricDefinitionsFromDefinitionIds.ts index 52935f567..8d890053a 100644 --- a/src/tools/web/pulse/listMetricDefinitionsFromDefinitionIds/listPulseMetricDefinitionsFromDefinitionIds.ts +++ b/src/tools/web/pulse/listMetricDefinitionsFromDefinitionIds/listPulseMetricDefinitionsFromDefinitionIds.ts @@ -17,7 +17,7 @@ export const getListPulseMetricDefinitionsFromDefinitionIdsTool = ( ): WebTool => { const listPulseMetricDefinitionsFromDefinitionIdsTool = new WebTool({ server, - name: 'list-pulse-metric-definitions-from-definition-ids', + name: 'list-pulse-metric-definitions', description: ` Retrieves a list of specific Pulse Metric Definitions using the Tableau REST API from a list of metric definition IDs. Use this tool when a user requests information about specific Pulse Metric Definitions on the current site. diff --git a/src/tools/web/pulse/listMetricsFromMetricDefinitionId/listPulseMetricsFromMetricDefinitionId.test.ts b/src/tools/web/pulse/listMetricsFromMetricDefinitionId/listPulseMetricsFromMetricDefinitionId.test.ts index 806cb1724..1e1520789 100644 --- a/src/tools/web/pulse/listMetricsFromMetricDefinitionId/listPulseMetricsFromMetricDefinitionId.test.ts +++ b/src/tools/web/pulse/listMetricsFromMetricDefinitionId/listPulseMetricsFromMetricDefinitionId.test.ts @@ -35,7 +35,7 @@ describe('listPulseMetricsFromMetricDefinitionIdTool', () => { const listPulseMetricsFromMetricDefinitionIdTool = getListPulseMetricsFromMetricDefinitionIdTool(new WebMcpServer()); expect(listPulseMetricsFromMetricDefinitionIdTool.name).toBe( - 'list-pulse-metrics-from-metric-definition-id', + 'list-pulse-metrics-from-definition-id', ); expect(listPulseMetricsFromMetricDefinitionIdTool.description).toContain( 'Retrieves a list of published Pulse Metrics from a Pulse Metric Definition', diff --git a/src/tools/web/pulse/listMetricsFromMetricDefinitionId/listPulseMetricsFromMetricDefinitionId.ts b/src/tools/web/pulse/listMetricsFromMetricDefinitionId/listPulseMetricsFromMetricDefinitionId.ts index 1e29715ff..84944493b 100644 --- a/src/tools/web/pulse/listMetricsFromMetricDefinitionId/listPulseMetricsFromMetricDefinitionId.ts +++ b/src/tools/web/pulse/listMetricsFromMetricDefinitionId/listPulseMetricsFromMetricDefinitionId.ts @@ -16,7 +16,7 @@ export const getListPulseMetricsFromMetricDefinitionIdTool = ( ): WebTool => { const listPulseMetricsFromMetricDefinitionIdTool = new WebTool({ server, - name: 'list-pulse-metrics-from-metric-definition-id', + name: 'list-pulse-metrics-from-definition-id', description: ` Retrieves a list of published Pulse Metrics from a Pulse Metric Definition using the Tableau REST API. Use this tool when a user requests to list Tableau Pulse Metrics for a specific Pulse Metric Definition on the current site. diff --git a/src/tools/web/toolName.test.ts b/src/tools/web/toolName.test.ts index 938e74f45..a00da8e3f 100644 --- a/src/tools/web/toolName.test.ts +++ b/src/tools/web/toolName.test.ts @@ -10,6 +10,12 @@ import { webToolNames, } from './toolName.js'; +// AWS Bedrock enforces a 64-char limit on tool names. When registered as a +// Claude Code plugin, every tool name is prefixed with +// mcp__plugin____ (minimum 22 chars with empty server key), +// leaving at most 42 characters for the tool name itself. +const MAX_TOOL_NAME_LENGTH = 42; + describe('WebToolName', () => { it('should validate each tool belongs to a group', () => { const toolNamesToGroups = Object.entries(webToolGroups).reduce( @@ -38,4 +44,13 @@ describe('WebToolName', () => { expect(isWebToolName(group), `Group ${group} is the same as a tool name`).toBe(false); } }); + + it('all tool names are within the max length limit', () => { + for (const name of webToolNames) { + expect( + name.length, + `Tool name "${name}" exceeds ${MAX_TOOL_NAME_LENGTH}-char limit (${name.length} chars)`, + ).toBeLessThanOrEqual(MAX_TOOL_NAME_LENGTH); + } + }); }); diff --git a/src/tools/web/toolName.ts b/src/tools/web/toolName.ts index 431a859fc..979778e17 100644 --- a/src/tools/web/toolName.ts +++ b/src/tools/web/toolName.ts @@ -25,11 +25,11 @@ export const webToolNames = [ 'get-custom-view-data', 'get-custom-view-image', 'list-all-pulse-metric-definitions', - 'list-pulse-metric-definitions-from-definition-ids', - 'list-pulse-metrics-from-metric-definition-id', + 'list-pulse-metric-definitions', + 'list-pulse-metrics-from-definition-id', 'list-pulse-metrics-from-metric-ids', 'list-pulse-metric-subscriptions', - 'generate-pulse-metric-value-insight-bundle', + 'generate-pulse-insight-bundle', 'generate-pulse-insight-brief', 'search-content', 'revoke-access-token', @@ -77,11 +77,11 @@ export const webToolGroups = { ], pulse: [ 'list-all-pulse-metric-definitions', - 'list-pulse-metric-definitions-from-definition-ids', - 'list-pulse-metrics-from-metric-definition-id', + 'list-pulse-metric-definitions', + 'list-pulse-metrics-from-definition-id', 'list-pulse-metrics-from-metric-ids', 'list-pulse-metric-subscriptions', - 'generate-pulse-metric-value-insight-bundle', + 'generate-pulse-insight-bundle', 'generate-pulse-insight-brief', ], 'content-exploration': ['search-content'],