Skip to main content
Glama
yusuferenkt

MCP JSON Database Server

by yusuferenkt

get_user_by_id

Retrieve user information from the JSON database using a specific user ID. Requires JWT authentication token for authorization to access secure user data.

Instructions

ID'ye göre kullanıcı bilgilerini getirir (Yetki gerekli)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesKullanıcı ID'si
tokenYesJWT token (yetki kontrolü için)

Implementation Reference

  • Handler implementation for get_user_by_id tool. Performs permission check, retrieves user from database by ID, excludes password, handles errors.
    case 'get_user_by_id': {
      const { id, token } = args;
      
      try {
        // Yetki kontrolü
        const requestUser = checkPermissionWithToken(token, PERMISSIONS.USER_READ);
        
        const user = db.users.find(u => u.id === id);
        
        if (!user) {
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({ 
                success: false, 
                message: 'Kullanıcı bulunamadı' 
              })
            }]
          };
        }
    
        // Kendi bilgilerini görüntüleme veya yetki kontrolü
        if (requestUser.userId !== id && !hasPermission(requestUser.role, PERMISSIONS.USER_READ)) {
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({ 
                success: false, 
                message: 'Bu kullanıcının bilgilerini görüntüleme yetkiniz yok' 
              })
            }]
          };
        }
    
        const { password, ...userWithoutPassword } = user;
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: true,
              data: userWithoutPassword,
              requestedBy: { id: requestUser.userId, role: requestUser.role }
            }, null, 2)
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({ 
              success: false, 
              message: error.message,
              requiredPermission: PERMISSIONS.USER_READ
            })
          }]
        };
      }
    }
  • src/index.js:232-243 (registration)
    Tool registration in ListTools response, including name, description, and input schema definition.
    {
      name: 'get_user_by_id',
      description: 'ID\'ye göre kullanıcı bilgilerini getirir (Yetki gerekli)',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'number', description: 'Kullanıcı ID\'si' },
          token: { type: 'string', description: 'JWT token (yetki kontrolü için)' }
        },
        required: ['id', 'token']
      }
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions authorization is required ('Yetki gerekli'), which is useful context about authentication needs. However, it lacks details on rate limits, error handling, what specific user information is returned, or any side effects. For a read operation with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

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

Conciseness4/5

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

The description is a single, concise sentence in Turkish that states the purpose and notes authorization. It's front-loaded with the core function and avoids unnecessary details. However, it could be slightly more structured by separating the authorization note, but overall it's efficient with minimal waste.

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?

Given the complexity (a read operation with authorization), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what user information is retrieved, the response format, error cases, or how authorization works with the token. For a tool that requires authentication and returns data, this leaves too much unspecified for effective agent use.

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%, with both parameters ('id' and 'token') documented in the schema. The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain format constraints, examples, or usage nuances. With high schema coverage, the baseline score of 3 is appropriate as the schema handles parameter documentation adequately.

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 tool's purpose: 'ID'ye göre kullanıcı bilgilerini getirir' translates to 'retrieves user information by ID', which is a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from sibling tools like 'get_user' or 'list_users' (though 'list_users' appears in siblings, suggesting potential overlap). The description is clear but lacks sibling differentiation.

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 minimal guidance: it mentions 'Yetki gerekli' (authorization required), which hints at a prerequisite but doesn't specify when to use this tool versus alternatives like 'list_users' or 'search_users'. There's no explicit when/when-not usage, no comparison to siblings, and no context for choosing this specific retrieval method over others.

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