trakt_get_auth_status
Verify Trakt.tv authentication status for your Plex account. Confirms whether the integration is active.
Instructions
Check Trakt.tv authentication status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/trakt/mcp-functions.ts:150-181 (handler)The actual implementation of trakt_get_auth_status handler. Calls this.traktClient.testConnection() and returns authentication status with user info if successful, or an error message if not.
async traktGetAuthStatus(): Promise<Record<string, unknown>> { this.initializeTraktClient(); try { const testResult = await this.traktClient.testConnection(); if (testResult.success && testResult.user) { return { authenticated: true, user: { username: testResult.user.username, name: testResult.user.name, vip: testResult.user.vip, joined_at: testResult.user.joined_at }, config: this.traktClient.getConfig(), message: 'Successfully authenticated with Trakt' }; } else { return { authenticated: false, error: testResult.error, message: 'Not authenticated with Trakt. Use trakt_authenticate to set up.' }; } } catch (error) { return { authenticated: false, error: error instanceof Error ? error.message : 'Authentication check failed' }; } } - src/trakt/tool-schemas.ts:28-32 (schema)Input/output schema definition for trakt_get_auth_status tool. No input parameters, just checks auth status.
{ name: "trakt_get_auth_status", description: "Check Trakt.tv authentication status", inputSchema: { type: "object" as const, properties: {} }, }, - src/trakt/tool-registry.ts:20-22 (registration)Registration of the tool in the tool registry, mapping 'trakt_get_auth_status' to the handler function traktFunctions.traktGetAuthStatus().
registry.register("trakt_get_auth_status", () => traktFunctions.traktGetAuthStatus().then(wrapResponse) ); - src/trakt/mcp-functions.ts:50-69 (helper)Helper method initializeTraktClient() that sets up the TraktClient used by the handler, reading config from environment variables.
private initializeTraktClient(): void { if (this.isInitialized) return; const config: TraktConfig = { baseUrl: process.env.TRAKT_BASE_URL || DEFAULT_TRAKT_API_URL, clientId: process.env.TRAKT_CLIENT_ID || '', clientSecret: process.env.TRAKT_CLIENT_SECRET || '', redirectUri: process.env.TRAKT_REDIRECT_URI || 'urn:ietf:wg:oauth:2.0:oob', accessToken: process.env.TRAKT_ACCESS_TOKEN, refreshToken: process.env.TRAKT_REFRESH_TOKEN }; if (!config.clientId || !config.clientSecret) { throw new Error('TRAKT_CLIENT_ID and TRAKT_CLIENT_SECRET environment variables are required'); } this.traktClient = new TraktClient(config); this.syncEngine = new TraktSyncEngine(this.traktClient, this.plexClient); this.isInitialized = true; }