Skip to main content
Glama
SLdragon

MCP User Profile Management Server

by SLdragon

create_job_details

Create job postings with guided prompts to fill missing required fields, ensuring complete and accurate listings.

Instructions

Create a new job posting with elicitation support for missing fields

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main execution handler for the 'create_job_details' tool. It processes inputs, elicits missing job fields, validates, creates the job, and returns success or error response.
    async (inputs, context) => {
      try {
        let jobData = { ...inputs };
        const missingFields = JobService.getMissingFields(jobData);
    
        if (missingFields.all.length > 0) {
          const { properties, required } = SchemaBuilder.buildJobSchema(missingFields.all);
          
          const elicitationResult = await elicitationHelper.elicitWithProgress(
            "Please provide job posting details",
            { 
              type: "object", 
              properties, 
              required: missingFields.required  // 只有必填字段是真正required的
            },
            inputs
          );
    
          if (elicitationResult.action === "accept" && elicitationResult.content) {
            Object.assign(jobData, elicitationResult.content);
          } else if (elicitationResult.action === "decline") {
            return utils.createErrorResponse("User declined to provide job information. No job posting was created.");
          } else {
            return utils.createErrorResponse("User cancelled the job creation process.");
          }
        }
    
        JobService.validateJob(jobData);
        const newJob = JobService.createJob(jobData);
    
        return utils.createSuccessResponse(
          `Successfully created job posting:\n${JSON.stringify(newJob, null, 2)}`
        );
      } catch (error) {
        return utils.createErrorResponse(`Error creating job posting: ${error.message}`);
      }
    }
  • tools/jobTools.js:5-48 (registration)
    The registration function that adds the 'create_job_details' tool to the MCP server, specifying name, description, input schema, and handler. Called from index.js.
    export function createJobTool(server, elicitationHelper) {
      return server.tool(
        "create_job_details",
        "Create a new job posting with elicitation support for missing fields",
        SchemaBuilder.getJobToolParams(),
        async (inputs, context) => {
          try {
            let jobData = { ...inputs };
            const missingFields = JobService.getMissingFields(jobData);
    
            if (missingFields.all.length > 0) {
              const { properties, required } = SchemaBuilder.buildJobSchema(missingFields.all);
              
              const elicitationResult = await elicitationHelper.elicitWithProgress(
                "Please provide job posting details",
                { 
                  type: "object", 
                  properties, 
                  required: missingFields.required  // 只有必填字段是真正required的
                },
                inputs
              );
    
              if (elicitationResult.action === "accept" && elicitationResult.content) {
                Object.assign(jobData, elicitationResult.content);
              } else if (elicitationResult.action === "decline") {
                return utils.createErrorResponse("User declined to provide job information. No job posting was created.");
              } else {
                return utils.createErrorResponse("User cancelled the job creation process.");
              }
            }
    
            JobService.validateJob(jobData);
            const newJob = JobService.createJob(jobData);
    
            return utils.createSuccessResponse(
              `Successfully created job posting:\n${JSON.stringify(newJob, null, 2)}`
            );
          } catch (error) {
            return utils.createErrorResponse(`Error creating job posting: ${error.message}`);
          }
        }
      );
    }
  • index.js:20-20 (registration)
    Invocation of the tool registration function in the main server setup.
    createJobTool(server, elicitationHelper);
  • Generates the input parameter schema for the create_job_details tool based on JOB_FIELD_SCHEMAS.
    static getJobToolParams() {
      const toolParams = {};
      for (const [key, schema] of Object.entries(this.JOB_FIELD_SCHEMAS)) {
        toolParams[key] = {
          type: schema.type,
          description: schema.description
        };
      }
      
      return toolParams;
    }
  • Static schema definitions for all job fields used in input schema and dynamic elicitation schema for the tool.
    static JOB_FIELD_SCHEMAS = {
      jobTitle: {
        type: "string",
        title: "Job Title",
        description: "The job title or position name",
        minLength: 2,
        maxLength: 100
      },
      description: {
        type: "string",
        title: "Job Description", 
        description: "Detailed description of the job responsibilities",
        minLength: 10,
        maxLength: 1000
      },
      company_email: {
        type: "string",
        title: "Company Email",
        description: "Contact email for the company",
        format: "email"
      },
      company_website: {
        type: "string", 
        title: "Company Website",
        description: "Company website URL",
        format: "uri"
      },
      salary: {
        type: "number",
        title: "Salary",
        description: "Annual salary in USD",
        minimum: 0,
        maximum: 1000000
      },
      experience_years: {
        type: "integer",
        title: "Required Experience",
        description: "Minimum years of experience required (optional)",
        minimum: 0,
        maximum: 50,
        default: 3
      },
      is_remote: {
        type: "boolean", 
        title: "Remote Work",
        description: "Is this a remote position?",
        default: false
      },
      is_active: {
        type: "boolean",
        title: "Active Posting",
        description: "Is this job posting currently active?",
        default: true
      },
      start_date: {
        type: "string",
        title: "Start Date", 
        description: "Expected start date (YYYY-MM-DD)",
        format: "date"
      },
      application_deadline: {
        type: "string",
        title: "Application Deadline",
        description: "Application deadline date and time",
        format: "date-time"
      },
      job_type: {
        type: "string",
        title: "Job Type",
        description: "Type of employment",
        enum: Object.keys(CONFIG.JOB_TYPES),
        enumNames: Object.values(CONFIG.JOB_TYPES)
      },
      priority: {
        type: "string",
        title: "Priority Level",
        description: "Hiring priority for this position", 
        enum: Object.keys(CONFIG.PRIORITIES),
        enumNames: Object.values(CONFIG.PRIORITIES)
      }
    };

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