validate_key
Verify IssueBadge API key authentication to confirm credentials function correctly before issuing digital badges and certificates.
Instructions
Validate an IssueBadge API key for authentication. Use this to test if your API credentials are working correctly.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | Yes | The API key to validate (usually starts with a number and pipe, e.g., "1|abc123...") |
Implementation Reference
- src/index.ts:415-426 (handler)The main handler for the 'validate_key' tool in the MCP server request handler switch statement. It validates input using ValidateKeySchema, calls apiClient.validateKey, and formats the response.case 'validate_key': { const validatedArgs = ValidateKeySchema.parse(args); const result = await apiClient.validateKey(validatedArgs.api_key); return { content: [ { type: 'text', text: `✅ API Key Validation Result:\n\n${JSON.stringify(result, null, 2)}`, }, ], }; }
- src/index.ts:65-67 (schema)Zod schema for validating the input arguments to the 'validate_key' tool, requiring an 'api_key' string.const ValidateKeySchema = z.object({ api_key: z.string().describe('The API key to validate'), });
- src/index.ts:246-259 (registration)Tool registration in the tools array, defining name, description, and inputSchema for the MCP server to list and recognize the 'validate_key' tool.{ name: 'validate_key', description: 'Validate an IssueBadge API key for authentication. Use this to test if your API credentials are working correctly.', inputSchema: { type: 'object', properties: { api_key: { type: 'string', description: 'The API key to validate (usually starts with a number and pipe, e.g., "1|abc123...")', }, }, required: ['api_key'], }, },
- src/index.ts:174-177 (helper)Helper method in IssueBadgeClient class that makes the HTTP POST request to '/validate-key' endpoint with the api_key, used by the tool handler.async validateKey(apiKey: string): Promise<ApiResponse> { const response = await this.client.post('/validate-key', { api_key: apiKey }); return response.data; }