Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/server/oauth/scopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']),
},
Expand All @@ -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']),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const getGeneratePulseMetricValueInsightBundleTool = (
): WebTool<typeof paramsSchema> => {
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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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({
Expand All @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getListPulseMetricDefinitionsFromDefinitionIdsTool = (
): WebTool<typeof paramsSchema> => {
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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getListPulseMetricsFromMetricDefinitionIdTool = (
): WebTool<typeof paramsSchema> => {
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.

Expand Down
15 changes: 15 additions & 0 deletions src/tools/web/toolName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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_<plugin>_<server_key>__ (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(
Expand Down Expand Up @@ -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);
}
});
});
12 changes: 6 additions & 6 deletions src/tools/web/toolName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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'],
Expand Down
Loading