set_api_token
Enable API authentication by configuring an API token, providing an alternative to traditional login methods for interacting with Folderr's services.
Instructions
Set an API token for authentication (alternative to login)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | API token generated from Folderr developers section |
Implementation Reference
- src/index.ts:281-307 (handler)The main handler function for the 'set_api_token' tool. It updates the configuration with the provided token, sets the Authorization header on the axios instance, saves the config to file, and returns a success or error response.private async handleSetApiToken(args: any) { try { // Update config and axios instance with new token this.config.token = args.token; this.axiosInstance.defaults.headers.common['Authorization'] = `Bearer ${this.config.token}`; this.saveConfig(); return { content: [ { type: 'text', text: 'Successfully set API token', }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Failed to set API token: ${error.message}`, }, ], isError: true, }; } }
- src/index.ts:114-123 (schema)Input schema definition for the set_api_token tool, specifying an object with a required 'token' property of type string.inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'API token generated from Folderr developers section', }, }, required: ['token'], },
- src/index.ts:111-124 (registration)Tool registration in the list_tools handler, defining name, description, and input schema.{ name: 'set_api_token', description: 'Set an API token for authentication (alternative to login)', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'API token generated from Folderr developers section', }, }, required: ['token'], }, },
- src/index.ts:219-220 (registration)Dispatcher case in the CallToolRequestSchema handler that routes calls to set_api_token to the handleSetApiToken method.case 'set_api_token': return await this.handleSetApiToken(request.params.arguments);