Skip to main content
Glama
SLdragon

MCP User Profile Management Server

by SLdragon

create_user_profile

Create new user profiles with interactive prompts to collect missing required information, ensuring complete and validated data entry.

Instructions

Create a new user profile with elicitation support for missing fields

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the create_user_profile tool: elicits missing user fields, validates, creates the user profile using UserService, and returns success/error response.
    async (inputs, context) => {
      try {
        let userData = { ...inputs };
        const missingFields = UserService.getMissingFields(userData);
    
        if (missingFields.length > 0) {
          const { properties, required } = SchemaBuilder.buildUserSchema(missingFields);
          
          const elicitationResult = await elicitationHelper.elicitWithProgress(
            "Please provide your user profile information",
            { type: "object", properties, required },
            inputs,
          );
    
          if (elicitationResult.action === "accept" && elicitationResult.content) {
            Object.assign(userData, elicitationResult.content);
          } else if (elicitationResult.action === "decline") {
            return utils.createErrorResponse("User declined to provide profile information. No profile was created.");
          } else {
            return utils.createErrorResponse("User cancelled the profile creation process.");
          }
        }
    
        UserService.validateUser(userData);
        const newUser = UserService.createUser(userData);
    
        return utils.createSuccessResponse(
          `Successfully created user profile:\n${JSON.stringify(newUser, null, 2)}`
        );
      } catch (error) {
        return utils.createErrorResponse(`Error creating user profile: ${error.message}`);
      }
    }
  • Defines the input schema/parameters for the create_user_profile tool based on USER_FIELD_SCHEMAS (name, email, age, role). Passed to server.tool.
    static getUserToolParams() {
      const toolParams = {};
      for (const [key, schema] of Object.entries(this.USER_FIELD_SCHEMAS)) {
        toolParams[key] = {
          type: schema.type,
          description: schema.description,
          optional: true
        };
      }
      
      return toolParams;
    }
  • index.js:16-16 (registration)
    Registers the create_user_profile tool on the MCP server by invoking createUserTool.
    createUserTool(server, elicitationHelper);
  • The createUserTool function that performs the server.tool registration for "create_user_profile".
    export function createUserTool(server, elicitationHelper) {
      return server.tool(
        "create_user_profile",
        "Create a new user profile with elicitation support for missing fields",
        SchemaBuilder.getUserToolParams(),
        async (inputs, context) => {
          try {
            let userData = { ...inputs };
            const missingFields = UserService.getMissingFields(userData);
    
            if (missingFields.length > 0) {
              const { properties, required } = SchemaBuilder.buildUserSchema(missingFields);
              
              const elicitationResult = await elicitationHelper.elicitWithProgress(
                "Please provide your user profile information",
                { type: "object", properties, required },
                inputs,
              );
    
              if (elicitationResult.action === "accept" && elicitationResult.content) {
                Object.assign(userData, elicitationResult.content);
              } else if (elicitationResult.action === "decline") {
                return utils.createErrorResponse("User declined to provide profile information. No profile was created.");
              } else {
                return utils.createErrorResponse("User cancelled the profile creation process.");
              }
            }
    
            UserService.validateUser(userData);
            const newUser = UserService.createUser(userData);
    
            return utils.createSuccessResponse(
              `Successfully created user profile:\n${JSON.stringify(newUser, null, 2)}`
            );
          } catch (error) {
            return utils.createErrorResponse(`Error creating user profile: ${error.message}`);
          }
        }
      );
    }
  • UserService static methods: getMissingFields (used for elicitation), validateUser, and createUser (stores new user in storage). Called by the handler.
    export class UserService {
      static getMissingFields(inputs) {
        const { name, email, age, role } = inputs;
        const missing = [];
        
        if (!name) missing.push("name");
        if (!email) missing.push("email");
        if (age === undefined) missing.push("age");
        if (!role) missing.push("role");
        
        return missing;
      }
    
      static validateUser(user) {
        if (user.email && !utils.validateEmail(user.email)) {
          throw new Error("Invalid email format. Please provide a valid email address.");
        }
      }
    
      static createUser(userData) {
        const newUser = {
          id: utils.getNextId(storage.users),
          name: userData.name,
          email: userData.email,
          age: userData.age,
          role: userData.role
        };
    
        storage.users.push(newUser);
        return newUser;
      }
    }
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. It mentions 'elicitation support for missing fields', which hints at interactive or guided behavior, but doesn't specify what that entails (e.g., prompts for input, default values, error handling). It lacks details on permissions, side effects, or response format, leaving gaps for a mutation tool.

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, efficient sentence that directly states the purpose and a key behavioral trait ('elicitation support'). It is front-loaded with the main action and avoids unnecessary words, making it highly concise and well-structured.

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

Completeness3/5

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

Given the tool has 0 parameters and no output schema, the description is adequate for a basic creation tool. However, as a mutation tool with no annotations, it should ideally provide more behavioral context (e.g., what happens on success/failure, data validation). The mention of elicitation adds some completeness, but gaps remain in transparency.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description adds value by implying that fields might be missing and elicitation is supported, which provides context beyond the empty schema. This compensates appropriately for the lack of parameters.

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 verb 'create' and the resource 'user profile', specifying it's for a 'new' profile. It distinguishes from siblings like list_users or search_users by focusing on creation rather than retrieval. However, it doesn't explicitly differentiate from create_job_details, which might be a similar creation operation for a different resource.

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 mentions 'elicitation support for missing fields', which implies usage when some profile data might be incomplete, but it doesn't provide explicit guidance on when to use this tool versus alternatives like list_users or search_users. No context about prerequisites, when-not scenarios, or clear alternatives is given.

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/SLdragon/mcp-elicitation-server'

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