diff --git a/src/tools/create-token-tool/CreateTokenTool.ts b/src/tools/create-token-tool/CreateTokenTool.ts index a7342e8..8ecc6ba 100644 --- a/src/tools/create-token-tool/CreateTokenTool.ts +++ b/src/tools/create-token-tool/CreateTokenTool.ts @@ -20,10 +20,6 @@ export class CreateTokenTool extends MapboxApiBasedTool< input: CreateTokenInput, accessToken?: string ): Promise<{ type: 'text'; text: string }> { - if (!accessToken) { - throw new Error('MAPBOX_ACCESS_TOKEN is not set'); - } - const username = MapboxApiBasedTool.getUserNameFromToken(accessToken); this.log( diff --git a/src/tools/preview-style-tool/PreviewStyleTool.ts b/src/tools/preview-style-tool/PreviewStyleTool.ts index 20b5814..6cd27b0 100644 --- a/src/tools/preview-style-tool/PreviewStyleTool.ts +++ b/src/tools/preview-style-tool/PreviewStyleTool.ts @@ -17,9 +17,10 @@ export class PreviewStyleTool extends MapboxApiBasedTool< } protected async execute( - input: PreviewStyleInput + input: PreviewStyleInput, + accessToken?: string ): Promise<{ type: 'text'; text: string }> { - const username = MapboxApiBasedTool.getUserNameFromToken(); + const username = MapboxApiBasedTool.getUserNameFromToken(accessToken); // Get list of tokens to find a public token const listTokensTool = new ListTokensTool();