Skip to content

Commit 0e355ae

Browse files
committed
clean test
1 parent 9418765 commit 0e355ae

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/tools/preview-style-tool/PreviewStyleTool.schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ export const PreviewStyleSchema = z.object({
44
styleId: z.string().describe('Style ID to preview'),
55
accessToken: z
66
.string()
7+
.startsWith(
8+
'pk.',
9+
'Invalid access token. Only public tokens (starting with pk.*) are allowed for preview URLs. Secret tokens (sk.*) cannot be used as they cannot be exposed in browser URLs.'
10+
)
711
.describe(
812
'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 an existing public token or get one from list_tokens_tool or create one with create_token_tool with styles:read permission.'
913
),

src/tools/preview-style-tool/PreviewStyleTool.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ export class PreviewStyleTool extends BaseTool<typeof PreviewStyleSchema> {
1717
protected async execute(
1818
input: PreviewStyleInput
1919
): Promise<{ type: 'text'; text: string }> {
20-
// Validate that the provided token is a public token
21-
if (!input.accessToken.startsWith('pk.')) {
22-
throw new Error(
23-
'Invalid access token. Only public tokens (starting with pk.*) are allowed for preview URLs. Secret tokens (sk.*) cannot be used as they cannot be exposed in browser URLs.'
24-
);
25-
}
26-
2720
const username = MapboxApiBasedTool.getUserNameFromToken(input.accessToken);
2821

2922
// Use the user-provided public token

0 commit comments

Comments
 (0)