Get Free API Key
get_stresszero_api_keyGenerate a free API key for StressZero's stress management tools, enabling access to AI-powered mental wellness resources with 500 monthly calls.
Instructions
Create a free StressZero API key (500 calls/month). Use this to help users get started with the API. The key is returned once and cannot be retrieved later. Requires a valid email address.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | User's email address for the API key | ||
| project_name | No | Name of the project using the API key | MCP Integration |
Implementation Reference
- src/index.ts:422-463 (handler)The handler function for the get_stresszero_api_key tool, which performs an API request to create the key and returns the result.
async ({ email, project_name }) => { const result = await apiRequest("/api/v1/keys", { method: "POST", body: JSON.stringify({ email, name: project_name ?? "MCP Integration", }), }); if (!result.success) { const errMsg = result.error?.message || "Unknown error"; const hint = result.error?.status === 409 ? "\nAn active API key already exists for this email." : ""; return { isError: true, content: [ { type: "text" as const, text: `API key creation failed: ${errMsg}${hint}`, }, ], }; } const data = result.data as Record<string, unknown>; return { content: [ { type: "text" as const, text: [ "API Key created successfully!", "", `Key: ${data?.api_key ?? "N/A"}`, `Tier: Free (500 calls/month)`, "", "IMPORTANT: Save this key now — it will NOT be shown again.", "", `Documentation: ${data?.docs_url ?? "https://stresszeroentrepreneur.fr/intelligence-api"}`, ].join("\n"), - src/index.ts:410-415 (schema)The input schema definition for the get_stresszero_api_key tool, validating the email and project_name inputs.
inputSchema: { email: z.string().email().describe("User's email address for the API key"), project_name: z.string().min(1).max(100).default("MCP Integration").optional().describe( "Name of the project using the API key", ), }, - src/index.ts:401-421 (registration)Registration of the get_stresszero_api_key tool using the server.registerTool method.
server.registerTool( "get_stresszero_api_key", { title: "Get Free API Key", description: "Create a free StressZero API key (500 calls/month). " + "Use this to help users get started with the API. " + "The key is returned once and cannot be retrieved later. " + "Requires a valid email address.", inputSchema: { email: z.string().email().describe("User's email address for the API key"), project_name: z.string().min(1).max(100).default("MCP Integration").optional().describe( "Name of the project using the API key", ), }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, }, },