Skip to content

Commit b4b54ba

Browse files
committed
clean test
1 parent 0e355ae commit b4b54ba

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

src/tools/style-comparison-tool/StyleComparisonTool.schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export const StyleComparisonSchema = z.object({
1313
),
1414
accessToken: z
1515
.string()
16+
.startsWith(
17+
'pk.',
18+
'Invalid token type. Style comparison requires a public token (pk.*) that can be used in browser URLs. Secret tokens (sk.*) cannot be exposed in client-side applications. Please provide a public token with styles:read permission.'
19+
)
1620
.describe(
1721
'Mapbox public access token (required, must start with pk.* and have styles:read permission). Secret tokens (sk.*) cannot be used as they cannot be exposed in browser URLs. Please use a public token or create one with styles:read permission.'
1822
),

src/tools/style-comparison-tool/StyleComparisonTool.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ export class StyleComparisonTool extends BaseTool<
1616
super({ inputSchema: StyleComparisonSchema });
1717
}
1818

19-
/**
20-
* Validates that the token is a public token
21-
*/
22-
private validatePublicToken(token: string): void {
23-
if (!token.startsWith('pk.')) {
24-
throw new Error(
25-
`Invalid token type. Style comparison requires a public token (pk.*) that can be used in browser URLs. ` +
26-
`Secret tokens (sk.*) cannot be exposed in client-side applications. ` +
27-
`Please provide a public token with styles:read permission.`
28-
);
29-
}
30-
}
31-
3219
/**
3320
* Processes style input to extract username/styleId format
3421
*/
@@ -61,9 +48,6 @@ export class StyleComparisonTool extends BaseTool<
6148
protected async execute(
6249
input: StyleComparisonInput
6350
): Promise<{ type: 'text'; text: string }> {
64-
// Validate that we have a public token
65-
this.validatePublicToken(input.accessToken);
66-
6751
// Process style IDs to get username/styleId format
6852
const beforeStyleId = this.processStyleId(input.before, input.accessToken);
6953
const afterStyleId = this.processStyleId(input.after, input.accessToken);

0 commit comments

Comments
 (0)