File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export class CreateTokenTool extends MapboxApiBasedTool<
2828 ) ;
2929
3030 // Check if any secret scopes are being used
31- const hasSecretScopes = input . scopes . some ( ( scope ) =>
31+ const hasSecretScopes = input . scopes ? .some ( ( scope ) =>
3232 SECRET_SCOPES . includes ( scope as ( typeof SECRET_SCOPES ) [ number ] )
3333 ) ;
3434
@@ -53,7 +53,7 @@ export class CreateTokenTool extends MapboxApiBasedTool<
5353 expires ?: string ;
5454 } = {
5555 note : input . note as string ,
56- scopes : input . scopes
56+ scopes : input . scopes || [ ]
5757 } ;
5858
5959 if ( input . allowedUrls ) {
Original file line number Diff line number Diff line change @@ -19,18 +19,25 @@ export class StyleComparisonTool extends BaseTool<
1919 /**
2020 * Processes style input to extract username/styleId format
2121 */
22- private processStyleId ( style : string , accessToken : string ) : string {
22+ private processStyleId (
23+ style : string | undefined ,
24+ accessToken ?: string
25+ ) : string {
2326 // If it's a full URL, extract the username/styleId part
24- if ( style . startsWith ( 'mapbox://styles/' ) ) {
27+ if ( style ? .startsWith ( 'mapbox://styles/' ) ) {
2528 return style . replace ( 'mapbox://styles/' , '' ) ;
2629 }
2730
2831 // If it contains a slash, assume it's already username/styleId format
29- if ( style . includes ( '/' ) ) {
32+ if ( style ? .includes ( '/' ) ) {
3033 return style ;
3134 }
3235
3336 // If it's just a style ID, try to get username from the token
37+ if ( ! style ) {
38+ throw new Error ( 'Style is required' ) ;
39+ }
40+
3441 try {
3542 const username = MapboxApiBasedTool . getUserNameFromToken ( accessToken ) ;
3643 return `${ username } /${ style } ` ;
You can’t perform that action at this time.
0 commit comments