Skip to main content
Loading navigation
Back to prompt library

External Skill Verification Tool Development

Linked challenge: SkillProof Document Agent

Prompt source

implementation26 lines4 sectionsNo variables1 code block
Create a Mastra AI tool named 'verify_ai_proficiency' that simulates an external service verifying a skill. This tool should accept `skill_name` and `proficiency_level` and return a mock `verification_status` ('Verified'/'Unverified') and `verification_score` (0-1). Demonstrate how your Mastra AI agent would call this tool to verify a generated SkillProof document and update its status.

```typescript
import { createTool } from '@mastra-ai/core';

const verifyAIProficiencyTool = createTool({
  name: 'verifyAIProficiency',
  description: 'Simulates external verification of AI proficiency.',
  input: { type: 'object', properties: { skillName: { type: 'string' }, proficiencyLevel: { type: 'string' } } },
  output: { type: 'object', properties: { verificationStatus: { type: 'string' }, verificationScore: { type: 'number' } } },
  async handler({ skillName, proficiencyLevel }) {
    // Mock logic for verification
    const score = proficiencyLevel === 'Expert' ? 0.9 + Math.random() * 0.1 : 0.5 + Math.random() * 0.2;
    const status = score > 0.7 ? 'Verified' : 'Unverified';
    return { verificationStatus: status, verificationScore: parseFloat(score.toFixed(2)), verifiedBy: 'MockAIProficiencyService' };
  },
});

// Mastra AI agent would have a flow like this:
// agent.onIntent('verify_document', async ({ state }) => {
//   const doc = state.get('skillProofDocument');
//   if (doc) {
//     const verificationResult = await agent.runTool(verifyAIProficiencyTool, { skillName: doc.skillName, proficiencyLevel: doc.proficiencyLevel });
//     state.set('skillProofDocument', { ...doc, verification: verificationResult });
//     return `Verification complete: ${verificationResult.verificationStatus}`;
//   }
//   return 'No document to verify.';
// });
```