Skip to main content
Glama

auth_status

Check current authentication status for FreshBooks integration to verify OAuth2 connection before using accounting, invoicing, and financial tools.

Instructions

Check current FreshBooks authentication status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'auth_status' that calls oauth.getStatus() and formats response as MCP content.
    private async handleAuthStatus() { const status = await this.oauth.getStatus(); return { content: [ { type: 'text', text: JSON.stringify(status, null, 2), }, ], }; }
  • src/server.ts:82-89 (registration)
    Tool registration in ListTools handler, defining name, description, and empty input schema.
    { name: 'auth_status', description: 'Check current FreshBooks authentication status', inputSchema: { type: 'object', properties: {}, }, },
  • Output schema/type definition for auth_status response.
    export interface AuthStatus { /** Whether currently authenticated with valid token */ authenticated: boolean; /** Seconds until token expires (if authenticated) */ expiresIn?: number; /** Active account ID (if authenticated) */ accountId?: string; /** Active business ID (if authenticated) */ businessId?: number; /** Reason for not being authenticated (if not authenticated) */ reason?: 'no_token' | 'token_expired' | 'invalid_token'; /** Whether a refresh token is available to restore session */ canRefresh?: boolean; }
  • Core logic for computing authentication status from token store, used by the tool handler.
    async getStatus(): Promise<AuthStatus> { const token = await this.tokenStore.get(); if (!token) { return { authenticated: false, reason: 'no_token', }; } const now = Math.floor(Date.now() / 1000); const expiresIn = token.expiresAt - now; if (expiresIn <= 0) { return { authenticated: false, reason: 'token_expired', canRefresh: !!token.refreshToken, }; } const status: AuthStatus = { authenticated: true, expiresIn, }; if (token.accountId) { status.accountId = token.accountId; } if (token.businessId !== undefined) { status.businessId = token.businessId; } return status; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Good-Samaritan-Software-LLC/freshbooks-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server