get-total-users
Retrieve the total user count of Compresto’s file compression app using real-time data from Compresto MCP for accurate usage insights and analysis.
Instructions
Get total users of Compresto
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/index.ts:47-76 (registration)Registers the MCP tool 'get-total-users'. The inline async handler fetches landing page data from the Supabase API endpoint and returns the totalUsers value as a text content block, or an error if fetch fails.server.tool( "get-total-users", "Get total users of Compresto", {}, async () => { const url = `${API_BASE}/v1/getLandingPageData`; const response = await makeSupabaseRequest<LandingPageDataResponse>(url); if (!response) { return { content: [ { type: "text", text: "Failed to fetch user data" } ], isError: true }; } return { content: [ { type: "text", text: response.data.totalUsers.toString() } ] }; }, );
- src/index.ts:19-35 (helper)Helper function that makes authenticated HTTP requests to the Supabase API using fetch, with error handling and JSON parsing. Used by the get-total-users handler.async function makeSupabaseRequest<T>(url: string): Promise<T | null> { const headers = { "User-Agent": USER_AGENT, Accept: "application/json", }; try { const response = await fetch(url, { headers }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return (await response.json()) as T; } catch (error) { console.error("Error making Supabase request:", error); return null; } }
- src/index.ts:38-45 (schema)TypeScript interface defining the structure of the landing page data response from the API, including totalUsers field used by the tool.interface LandingPageDataResponse { data: { totalUsers: number; totalCompressedVideos: number; totalReducedSize: number; monthlyUsers: number; } }