Skip to main content
Glama
huseyindol

User Info MCP Server

by huseyindol

Kullanıcı Getir

get_user_by_id

Retrieve specific user details by providing their unique ID number. This tool fetches user information from the User Info MCP Server database for lookup and management purposes.

Instructions

ID'ye göre belirli bir kullanıcıyı getir

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesKullanıcının ID'si

Implementation Reference

  • The handler function that executes the tool logic for get_user_by_id. It calls the user service to fetch the user and returns a formatted MCP ToolResponse.
    static async handleGetUserById({ id }: { id: number }): Promise<ToolResponse> {
      try {
        const result = await userService.getUserById(id);
        
        return {
          content: [
            {
              type: "text",
              text: result.success 
                ? JSON.stringify(result.data, null, 2)
                : result.error || "Kullanıcı bulunamadı",
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: "Kullanıcı getirme işleminde hata oluştu",
            },
          ],
        };
      }
    }
  • Zod schema defining the input for the get_user_by_id tool, requiring a positive integer ID.
    export const GetUserByIdInputSchema = {
      id: z.number().int().positive().describe("Kullanıcının ID'si")
    };
  • Registration of the get_user_by_id tool on the MCP server, specifying name, metadata, input schema, and handler.
    server.registerTool(
      "get_user_by_id",
      {
        title: "Kullanıcı Getir",
        description: "ID'ye göre belirli bir kullanıcıyı getir",
        inputSchema: GetUserByIdInputSchema,
      },
      UserController.handleGetUserById
    );
  • Helper service method that performs the actual user lookup by ID, including business rule validation and error handling.
    async getUserById(id: number): Promise<ServiceResult<User>> {
      try {
        // Business rule: ID must be positive
        if (id <= 0) {
          return {
            success: false,
            error: "Geçersiz kullanıcı ID'si. ID pozitif bir sayı olmalıdır."
          };
        }
    
        const user = await userRepository.findById(id);
        
        if (!user) {
          return {
            success: false,
            error: `ID ${id} ile kullanıcı bulunamadı`
          };
        }
    
        return {
          success: true,
          data: user,
          message: "Kullanıcı başarıyla bulundu"
        };
      } catch (error) {
        return {
          success: false,
          error: "Kullanıcı getirilirken hata oluştu"
        };
      }
    }
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 only states the basic action ('getir' - get/retrieve), implying a read-only operation, but doesn't disclose any behavioral traits like error handling (e.g., what happens if the ID doesn't exist), authentication requirements, rate limits, or response format. For a tool with zero annotation coverage, 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 a single, clear sentence: 'ID'ye göre belirli bir kullanıcıyı getir' (Get a specific user by ID). It's front-loaded with the core purpose, with zero wasted words or redundancy. Every word earns its place by specifying the action and key constraint.

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 tool's simplicity (1 parameter, 100% schema coverage) but lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like error cases or response format, which are crucial for an AI agent to use it correctly. For a read operation with no structured output information, more context is needed.

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?

The description mentions 'ID'ye göre' (by ID), which aligns with the single parameter 'id' in the schema. Schema description coverage is 100%, with the schema already documenting the parameter as 'Kullanıcının ID'si' (user's ID) with type integer and exclusiveMinimum: 0. The description adds no additional meaning beyond what the schema provides, so the baseline score of 3 is appropriate.

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: 'get a specific user by ID' (ID'ye göre belirli bir kullanıcıyı getir). It specifies the verb ('getir' - get/retrieve) and resource ('kullanıcı' - user), distinguishing it from siblings like get_all_users (which retrieves all users) or search tools. However, it doesn't explicitly differentiate from other search tools that might also retrieve users by ID indirectly.

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. It doesn't mention sibling tools like get_all_users (for listing all users) or search_users_by_email/name/phone (for searching by other criteria). There's no context about prerequisites, such as needing a valid user ID, or when this tool is preferred over search tools.

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/huseyindol/McpProjectScaffold'

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