Skip to main content
Glama

upgrade_subscription

Convert your free todo management account to a paid plan to access premium features and remove usage limits.

Instructions

Upgrade user subscription to paid plan

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
authTokenYesAuthentication token from Kinde

Implementation Reference

  • src/server.ts:270-283 (registration)
    Registration of the 'upgrade_subscription' tool in the listTools handler, including its name, description, and input schema that requires an authToken.
    { name: 'upgrade_subscription', description: 'Upgrade user subscription to paid plan', inputSchema: { type: 'object', properties: { authToken: { type: 'string', description: 'Authentication token from Kinde', }, }, required: ['authToken'], }, },
  • Input schema definition for the upgrade_subscription tool, specifying the required authToken parameter.
    inputSchema: { type: 'object', properties: { authToken: { type: 'string', description: 'Authentication token from Kinde', }, }, required: ['authToken'], },
  • The handler logic for the upgrade_subscription tool. It validates the authToken argument, verifies the token to get user info, simulates a subscription upgrade by updating the database to set subscription_status to 'active' and plan to 'premium', and returns a success message.
    case 'upgrade_subscription': { 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' }], }; } // In a real implementation, you would integrate with a payment processor // For now, we'll simulate the upgrade await sql` INSERT INTO users (user_id, subscription_status, plan) VALUES (${user.userId}, 'active', 'premium') ON CONFLICT (user_id) DO UPDATE SET subscription_status = 'active', plan = 'premium' `; return { content: [{ type: 'text', text: JSON.stringify({ success: true, message: 'Subscription upgraded successfully! You can now create unlimited todos.', subscriptionStatus: 'active' }, null, 2) }], }; }
  • General helper function validateArgs used by the upgrade_subscription handler to check for required arguments like authToken.
    function validateArgs(args: any, requiredFields: string[]): { valid: boolean; error?: string; validatedArgs?: any } { if (!args) { return { valid: false, error: 'Missing arguments' }; } for (const field of requiredFields) { if (!args[field]) { return { valid: false, error: `Missing required field: ${field}` }; } } return { valid: true, validatedArgs: args }; }

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/sholajegede/todo_mcp_server'

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