verify_presentation
Validate verifiable presentations by checking signatures, verifying holders, and confirming all included credentials for authentication in the HiveAuth ecosystem.
Instructions
Verify a verifiable presentation containing multiple credentials. Validates presentation signature, holder verification, and all included credentials.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| presentation | Yes | The verifiable presentation to verify |
Implementation Reference
- src/tools/verifyPresentation.ts:8-86 (handler)The main handler function that executes the verify_presentation tool logic. It validates the input presentation, calls the HiveAuth API endpoint to verify it, processes the response, and returns formatted results including status and details.
export async function verifyPresentation(args: any): Promise<CallToolResult> { // Validate and sanitize input const validation = validateAndSanitizeInput(VerifyPresentationInputSchema, args, 'verify_presentation'); if (!validation.success) { return createValidationErrorResult(validation.error!); } const data = validation.data!; const { presentation } = data; const HIVEAUTH_API_BASE_URL = process.env.HIVEAUTH_API_BASE_URL || 'http://localhost:3000'; const VERIFY_PRESENTATION_ENDPOINT = `${HIVEAUTH_API_BASE_URL}/api/verify-presentation`; try { const response = await fetch(VERIFY_PRESENTATION_ENDPOINT, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ presentation }), }); if (!response.ok) { const errorData = await response.json().catch(() => ({ message: response.statusText })); throw new Error(`Failed to verify presentation: ${errorData.message}`); } const result = await response.json(); const statusText = result.verified ? '✅ VERIFIED' : '❌ INVALID'; const details = []; if (result.verified) { details.push('• Presentation signature: ✅ Valid'); details.push('• Holder verification: ✅ Valid'); const credentialCount = presentation.verifiableCredential?.length || 0; details.push(`• Credentials verified: ${credentialCount}`); if (result.credentialResults) { result.credentialResults.forEach((credResult: any, index: number) => { const credStatus = credResult.verified ? '✅' : '❌'; details.push(` - Credential ${index + 1}: ${credStatus} ${credResult.verified ? 'Valid' : 'Invalid'}`); }); } } else { details.push(`• Error: ${result.message || 'Unknown verification error'}`); if (result.errors) { result.errors.forEach((error: string) => { details.push(`• ${error}`); }); } } return { content: [ { type: 'text', text: `Presentation Verification Result: ${statusText}\n\n${details.join('\n')}` }, { type: 'text', text: `\`\`\`json\n${JSON.stringify(result, null, 2)}\n\`\`\`` } ] }; } catch (error: any) { return { content: [ { type: 'text', text: `Failed to verify presentation: ${error.message}` } ], isError: true }; } } - src/schemas/toolSchemas.ts:105-107 (schema)Zod input schema definition for the verify_presentation tool, validating the required 'presentation' field using the PresentationSchema.
export const VerifyPresentationInputSchema = z.object({ presentation: PresentationSchema.describe('The verifiable presentation to verify') }); - src/index.ts:89-90 (registration)Registration of the verify_presentation tool in the main MCP server request handler switch statement, dispatching to the verifyPresentation handler function.
case 'verify_presentation': return await verifyPresentation(args); - src/utils/schemaConverter.ts:27-29 (registration)MCP Tool definition registration in TOOL_DEFINITIONS array, providing name, description, and input schema reference for automatic conversion to MCP tool format via createMCPTools().
name: 'verify_presentation', description: 'Verify a verifiable presentation containing multiple credentials. Validates presentation signature, holder verification, and all included credentials.', inputSchema: TOOL_SCHEMAS.verify_presentation - src/schemas/toolSchemas.ts:180-180 (schema)Mapping of tool name to its input schema in the TOOL_SCHEMAS constant, used for schema lookup in tool definitions.
verify_presentation: VerifyPresentationInputSchema,