verify_token
Validate JWT tokens to authenticate users and secure access to JSON database operations, ensuring only authorized interactions with project tracking, user management, and analytics features.
Instructions
JWT token'ın geçerliliğini kontrol eder
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | JWT token |
Implementation Reference
- src/index.js:476-499 (handler)The execution handler for the 'verify_token' tool within the CallToolRequestSchema switch statement. It extracts the token from arguments, calls verifyToken helper, and returns success with decoded user data or error message.case 'verify_token': { const { token } = args; try { const decoded = verifyToken(token); return { content: [{ type: 'text', text: JSON.stringify({ success: true, message: 'Token geçerli', user: decoded }) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: error.message }) }] }; } }
- src/index.js:97-106 (registration)Registration of the 'verify_token' tool in the tools list returned by ListToolsRequestHandler, including name, description, and input schema definition.name: 'verify_token', description: 'JWT token\'ın geçerliliğini kontrol eder', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' } }, required: ['token'] } },
- src/index.js:99-104 (schema)Input schema definition for the 'verify_token' tool, specifying the required 'token' string parameter.inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' } }, required: ['token']
- src/auth.js:28-34 (helper)Helper function verifyToken that performs the core JWT token verification using jsonwebtoken.verify and throws an error on invalid tokens.export function verifyToken(token) { try { return jwt.verify(token, JWT_SECRET); } catch (error) { throw new Error('Geçersiz token'); } }