authenticate
Complete OAuth2 authentication with authorization code to enable interaction with Google Slides presentations for creating slides, adding shapes, and managing content.
Instructions
Complete OAuth2 authentication with authorization code
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Authorization code from OAuth2 flow |
Implementation Reference
- src/index.ts:232-242 (handler)The handler function for the 'authenticate' tool. It calls the auth service to exchange the authorization code for tokens and returns a success message.private async handleAuthenticate(args: { code: string }): Promise<CallToolResult> { await this.auth.getTokens(args.code); return { content: [ { type: 'text', text: 'Authentication successful! You can now use Google Slides tools.', }, ], }; }
- src/index.ts:146-159 (schema)The schema definition for the 'authenticate' tool, including input schema for the authorization code, registered in the listTools handler.{ name: 'authenticate', description: 'Complete OAuth2 authentication with authorization code', inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'Authorization code from OAuth2 flow', }, }, required: ['code'], }, },
- src/index.ts:173-174 (registration)Registration of the 'authenticate' tool handler in the switch statement of the callTool request handler.case 'authenticate': return await this.handleAuthenticate(args as { code: string });
- src/auth.ts:45-51 (helper)Helper function in the auth service that performs the actual token exchange using the authorization code and saves the tokens to file.async getTokens(code: string): Promise<void> { const { tokens } = await this.oauth2Client.getToken(code); this.oauth2Client.setCredentials(tokens); // Save tokens for future use await this.saveTokens(tokens); }