Skip to main content
Glama
yusuferenkt

MCP JSON Database Server

by yusuferenkt

login

Authenticate users to access the JSON Database Server by verifying email and password credentials, then receive a JWT token for secure API operations.

Instructions

Kullanıcı giriş yapar ve JWT token alır

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesKullanıcı e-posta adresi
passwordYesKullanıcı şifresi

Implementation Reference

  • The main execution logic for the 'login' tool. Validates user credentials against the database, generates a JWT token upon successful authentication, handles errors for invalid users or passwords, and logs audit events.
    case 'login': {
      const { email, password } = args;
      
      // Kullanıcıyı bul
      const user = db.users.find(u => u.email === email);
      if (!user) {
        // Başarısız login denemesini logla
        await auditLogger.loginFailed(email, { reason: 'user_not_found' });
        
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({ success: false, message: 'Kullanıcı bulunamadı' })
          }]
        };
      }
    
      // Şifreyi kontrol et
      const isPasswordValid = await comparePassword(password, user.password);
      if (!isPasswordValid) {
        // Başarısız login denemesini logla
        await auditLogger.loginFailed(email, { reason: 'invalid_password', userId: user.id });
        
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({ success: false, message: 'Geçersiz şifre' })
          }]
        };
      }
    
      // JWT token oluştur
      const token = generateToken(user.id, user.email, user.role);
    
      // Başarılı login'i logla
      await auditLogger.loginSuccess(user.id, user.role, { 
        email, 
        loginTime: new Date().toISOString(),
        tokenGenerated: true 
      });
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({ 
            success: true, 
            message: 'Giriş başarılı',
            token,
            user: { 
              id: user.id, 
              name: user.name, 
              email: user.email, 
              role: user.role,
              department: user.department,
              position: user.position
            }
          })
        }]
      };
    }
  • The input schema definition for the 'login' tool, specifying required email and password fields. This is part of the tool list returned by ListToolsRequest.
    {
      name: 'login',
      description: 'Kullanıcı giriş yapar ve JWT token alır',
      inputSchema: {
        type: 'object',
        properties: {
          email: { type: 'string', description: 'Kullanıcı e-posta adresi' },
          password: { type: 'string', description: 'Kullanıcı şifresi' }
        },
        required: ['email', 'password']
      }
    },
  • Helper functions for logging successful and failed login attempts to the audit log system, used within the login handler.
    loginSuccess: (userId, userRole, details = {}) => 
      logAudit(userId, userRole, 'LOGIN_SUCCESS', AUDIT_CATEGORIES.AUTH, AUDIT_LEVELS.INFO, details),
      
    loginFailed: (email, details = {}) => 
      logAudit(null, null, 'LOGIN_FAILED', AUDIT_CATEGORIES.AUTH, AUDIT_LEVELS.WARN, { email, ...details }),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions authentication and token acquisition, it doesn't cover critical aspects like required permissions, rate limits, error conditions, or what happens on successful/failed login. For a security-sensitive tool, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that directly states the tool's purpose and outcome. There's zero wasted language, and it's appropriately front-loaded with the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a critical authentication tool with no annotations and no output schema, the description is insufficient. It doesn't explain the JWT token format, expiration, usage, or error responses. Given the security implications and lack of structured metadata, the description should provide more complete context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters (email and password) adequately. The description doesn't add any meaningful parameter semantics beyond what's in the schema, maintaining the baseline score for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('giriş yapar' - logs in) and the outcome ('JWT token alır' - gets JWT token), providing a specific verb and resource. However, it doesn't differentiate from the sibling 'register' tool, which handles user creation rather than authentication.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'register' for new users or 'verify_token' for token validation. It simply states what the tool does without context about prerequisites or appropriate scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yusuferenkt/mcp-database'

If you have feedback or need assistance with the MCP directory API, please join our Discord server