get_subscription_status
Check your subscription plan and current todo usage to manage your account limits and billing status.
Instructions
Get the user's subscription status and todo usage
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| authToken | Yes | Authentication token from Kinde |
Implementation Reference
- src/server.ts:466-510 (handler)Executes the get_subscription_status tool: validates authToken, verifies user from token, fetches or creates user subscription record from DB, returns JSON with subscription status, todos used/remaining.case 'get_subscription_status': { const validation = validateArgs(args, ['authToken']); if (!validation.valid) { return { content: [{ type: 'text', text: `Error: ${validation.error}` }], }; } const user = await verifyToken(validation.validatedArgs!.authToken as string); if (!user) { return { content: [{ type: 'text', text: 'Error: Invalid authentication token' }], }; } const subscription = await sql` SELECT * FROM users WHERE user_id = ${user.userId} `; // If no subscription exists, create one if (subscription.length === 0) { await sql` INSERT INTO users (user_id, subscription_status, free_todos_used) VALUES (${user.userId}, 'free', 0) `; } const userSub = subscription[0] || { subscription_status: 'free', free_todos_used: 0 }; return { content: [{ type: 'text', text: JSON.stringify({ success: true, subscription: { status: userSub.subscription_status || 'free', freeTodosUsed: userSub.free_todos_used || 0, totalTodosCreated: userSub.total_todos_created || 0, freeTodosRemaining: Math.max(0, 5 - (userSub.free_todos_used || 0)), } }, null, 2) }], }; }
- src/server.ts:256-269 (registration)Registers the get_subscription_status tool in the ListTools response, including name, description, and input schema requiring authToken.{ name: 'get_subscription_status', description: 'Get the user\'s subscription status and todo usage', inputSchema: { type: 'object', properties: { authToken: { type: 'string', description: 'Authentication token from Kinde', }, }, required: ['authToken'], }, },
- src/server.ts:259-268 (schema)Input schema definition for get_subscription_status tool: requires authToken string.inputSchema: { type: 'object', properties: { authToken: { type: 'string', description: 'Authentication token from Kinde', }, }, required: ['authToken'], },