UNPKG

@coretext-ai/qa-greenhouse-b9c0d1e2-f3a4-4567-a890-901234567890

Version:
1,396 lines 62.1 kB
import { Logger } from '../services/logger.js';
export class GreenhouseTools {
    constructor(client) {
        this.initialized = false;
        this.client = client;
        // Get logger from client if available, otherwise create fallback
        this.logger = client.logger || new Logger({
            logLevel: 'ERROR',
            component: 'tools',
            enableConsole: true,
            enableShipping: false,
            serverName: ''
        });
    }
    async ensureInitialized() {
        if (!this.initialized) {
            // Log tools initialization now that client is ready
            this.logger.info('TOOLS_INIT', 'Tools instance initialization started', {
                integration: 'greenhouse',
                isOAuth: false
            });
            this.logger.info('CLIENT_INITIALIZATION', 'Starting client initialization', {
                isOAuth: false
            });
            this.initialized = true;
            this.logger.info('CLIENT_INITIALIZATION', 'Client initialization completed', {
                initialized: this.initialized
            });
        }
    }
    getToolDefinitions() {
        return [
            {
                name: 'greenhouse_list_applications',
                description: 'List all applications with optional filtering by job, candidate, or status',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                        created_before: {
                            type: 'string',
                            description: 'Return applications created before this date (ISO 8601 format)'
                        },
                        created_after: {
                            type: 'string',
                            description: 'Return applications created after this date (ISO 8601 format)'
                        },
                        last_activity_after: {
                            type: 'string',
                            description: 'Return applications with last activity after this date (ISO 8601 format)'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_application',
                description: 'Retrieve detailed information about a specific application',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_create_application',
                description: 'Create a new application for an existing candidate',
                inputSchema: {
                    type: 'object',
                    properties: {
                        candidate_id: {
                            type: 'string',
                            description: 'ID of the candidate to create application for'
                        },
                        job_id: {
                            type: 'string',
                            description: 'ID of the job to apply to'
                        },
                        source_id: {
                            type: 'string',
                            description: 'ID of the application source'
                        },
                        initial_stage_id: {
                            type: 'string',
                            description: 'ID of the initial stage for the application'
                        },
                        referrer: {
                            type: 'object',
                            description: 'Referrer information with type and value'
                        },
                        custom_fields: {
                            type: 'object',
                            description: 'Custom field values for the application'
                        },
                    },
                    required: ['candidate_id', 'job_id',]
                }
            },
            {
                name: 'greenhouse_update_application',
                description: 'Update an existing application's properties',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                        source_id: {
                            type: 'string',
                            description: 'ID of the application source'
                        },
                        referrer: {
                            type: 'object',
                            description: 'Referrer information with type and value'
                        },
                        custom_fields: {
                            type: 'object',
                            description: 'Custom field values to update'
                        },
                    },
                    required: ['id',]
                }
            },
            {
                name: 'greenhouse_move_application',
                description: 'Move an application to a different stage within the same job',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                        from_stage_id: {
                            type: 'string',
                            description: 'Current stage ID'
                        },
                        to_stage_id: {
                            type: 'string',
                            description: 'Target stage ID'
                        },
                    },
                    required: ['id', 'from_stage_id', 'to_stage_id']
                }
            },
            {
                name: 'greenhouse_transfer_application',
                description: 'Transfer an application to a different job',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                        new_job_id: {
                            type: 'string',
                            description: 'Target job ID'
                        },
                        new_stage_id: {
                            type: 'string',
                            description: 'Target stage ID in the new job'
                        },
                    },
                    required: ['id', 'new_job_id',]
                }
            },
            {
                name: 'greenhouse_reject_application',
                description: 'Reject an application with reason and optional email notification',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                        rejection_reason_id: {
                            type: 'string',
                            description: 'ID of the rejection reason'
                        },
                        notes: {
                            type: 'string',
                            description: 'Additional notes about the rejection'
                        },
                        rejection_email: {
                            type: 'object',
                            description: 'Email configuration with send_email_at and email_template_id'
                        },
                    },
                    required: ['id', 'rejection_reason_id',]
                }
            },
            {
                name: 'greenhouse_hire_application',
                description: 'Hire a candidate by marking their application as hired',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                        start_date: {
                            type: 'string',
                            description: 'Hire start date (YYYY-MM-DD format)'
                        },
                        opening_id: {
                            type: 'string',
                            description: 'ID of the job opening to fill'
                        },
                        close_reason_id: {
                            type: 'string',
                            description: 'ID of the close reason'
                        },
                    },
                    required: ['id',]
                }
            },
            {
                name: 'greenhouse_convert_prospect',
                description: 'Convert a prospect application to a candidate application',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                        job_id: {
                            type: 'string',
                            description: 'Target job ID for conversion'
                        },
                        initial_stage_id: {
                            type: 'string',
                            description: 'Initial stage ID in the target job'
                        },
                    },
                    required: ['id', 'job_id',]
                }
            },
            {
                name: 'greenhouse_list_candidates',
                description: 'List all candidates with optional filtering and pagination',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                        created_before: {
                            type: 'string',
                            description: 'Return candidates created before this date (ISO 8601 format)'
                        },
                        created_after: {
                            type: 'string',
                            description: 'Return candidates created after this date (ISO 8601 format)'
                        },
                        updated_before: {
                            type: 'string',
                            description: 'Return candidates updated before this date (ISO 8601 format)'
                        },
                        updated_after: {
                            type: 'string',
                            description: 'Return candidates updated after this date (ISO 8601 format)'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_candidate',
                description: 'Retrieve detailed information about a specific candidate',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Candidate ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_create_candidate',
                description: 'Create a new candidate with contact information and optional application',
                inputSchema: {
                    type: 'object',
                    properties: {
                        first_name: {
                            type: 'string',
                            description: 'Candidate's first name'
                        },
                        last_name: {
                            type: 'string',
                            description: 'Candidate's last name'
                        },
                        company: {
                            type: 'string',
                            description: 'Candidate's current company'
                        },
                        title: {
                            type: 'string',
                            description: 'Candidate's current job title'
                        },
                        phone_numbers: {
                            type: 'array',
                            description: 'Array of phone number objects with value and type'
                        },
                        email_addresses: {
                            type: 'array',
                            description: 'Array of email address objects with value and type'
                        },
                        addresses: {
                            type: 'array',
                            description: 'Array of address objects with value and type'
                        },
                        website_addresses: {
                            type: 'array',
                            description: 'Array of website address objects with value and type'
                        },
                        social_media_addresses: {
                            type: 'array',
                            description: 'Array of social media address objects with value'
                        },
                        recruiter: {
                            type: 'object',
                            description: 'Recruiter assignment with user_id or email'
                        },
                        coordinator: {
                            type: 'object',
                            description: 'Coordinator assignment with user_id or email'
                        },
                        tags: {
                            type: 'array',
                            description: 'Array of tag strings'
                        },
                        custom_fields: {
                            type: 'object',
                            description: 'Custom field values for the candidate'
                        },
                        activity_feed_notes: {
                            type: 'array',
                            description: 'Array of note objects to add to activity feed'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_update_candidate',
                description: 'Update an existing candidate's information',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Candidate ID'
                        },
                        first_name: {
                            type: 'string',
                            description: 'Candidate's first name'
                        },
                        last_name: {
                            type: 'string',
                            description: 'Candidate's last name'
                        },
                        company: {
                            type: 'string',
                            description: 'Candidate's current company'
                        },
                        title: {
                            type: 'string',
                            description: 'Candidate's current job title'
                        },
                        recruiter: {
                            type: 'object',
                            description: 'Recruiter assignment with user_id or email'
                        },
                        coordinator: {
                            type: 'object',
                            description: 'Coordinator assignment with user_id or email'
                        },
                        tags: {
                            type: 'array',
                            description: 'Array of tag strings'
                        },
                        custom_fields: {
                            type: 'object',
                            description: 'Custom field values to update'
                        },
                    },
                    required: ['id',]
                }
            },
            {
                name: 'greenhouse_delete_candidate',
                description: 'Delete a candidate and all associated applications',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Candidate ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_list_jobs',
                description: 'List all jobs with optional filtering and pagination',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                        created_before: {
                            type: 'string',
                            description: 'Return jobs created before this date (ISO 8601 format)'
                        },
                        created_after: {
                            type: 'string',
                            description: 'Return jobs created after this date (ISO 8601 format)'
                        },
                        updated_before: {
                            type: 'string',
                            description: 'Return jobs updated before this date (ISO 8601 format)'
                        },
                        updated_after: {
                            type: 'string',
                            description: 'Return jobs updated after this date (ISO 8601 format)'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_job',
                description: 'Retrieve detailed information about a specific job',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Job ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_create_job',
                description: 'Create a new job posting with hiring team and requirements',
                inputSchema: {
                    type: 'object',
                    properties: {
                        template_job_id: {
                            type: 'string',
                            description: 'ID of job to use as template'
                        },
                        number_of_openings: {
                            type: 'number',
                            description: 'Number of openings for this job'
                        },
                        job_post_name: {
                            type: 'string',
                            description: 'Name for the job post'
                        },
                        job_name: {
                            type: 'string',
                            description: 'Internal name for the job'
                        },
                        department_id: {
                            type: 'string',
                            description: 'ID of the department'
                        },
                        office_ids: {
                            type: 'array',
                            description: 'Array of office IDs'
                        },
                        requisition_id: {
                            type: 'string',
                            description: 'External requisition ID'
                        },
                        hiring_team: {
                            type: 'object',
                            description: 'Hiring team configuration with hiring_managers, recruiters, coordinators, sourcers'
                        },
                        custom_fields: {
                            type: 'object',
                            description: 'Custom field values for the job'
                        },
                    },
                    required: ['job_name',]
                }
            },
            {
                name: 'greenhouse_update_job',
                description: 'Update an existing job's properties',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Job ID'
                        },
                        name: {
                            type: 'string',
                            description: 'Job name'
                        },
                        requisition_id: {
                            type: 'string',
                            description: 'External requisition ID'
                        },
                        notes: {
                            type: 'string',
                            description: 'Internal notes about the job'
                        },
                        team_and_responsibilities: {
                            type: 'string',
                            description: 'Team and responsibilities description'
                        },
                        how_to_sell_this_job: {
                            type: 'string',
                            description: 'How to sell this job description'
                        },
                        custom_fields: {
                            type: 'object',
                            description: 'Custom field values to update'
                        },
                    },
                    required: ['id',]
                }
            },
            {
                name: 'greenhouse_get_job_post',
                description: 'Retrieve the job post associated with a job',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Job ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_list_job_stages',
                description: 'List all job stages with interview details',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_job_stage',
                description: 'Retrieve details about a specific job stage',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Job stage ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_list_scheduled_interviews',
                description: 'List scheduled interviews with optional filtering',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                        created_before: {
                            type: 'string',
                            description: 'Return interviews created before this date (ISO 8601 format)'
                        },
                        created_after: {
                            type: 'string',
                            description: 'Return interviews created after this date (ISO 8601 format)'
                        },
                        starts_before: {
                            type: 'string',
                            description: 'Return interviews starting before this date (ISO 8601 format)'
                        },
                        starts_after: {
                            type: 'string',
                            description: 'Return interviews starting after this date (ISO 8601 format)'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_scheduled_interview',
                description: 'Retrieve details about a specific scheduled interview',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Scheduled interview ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_create_scheduled_interview',
                description: 'Create a new scheduled interview for an application',
                inputSchema: {
                    type: 'object',
                    properties: {
                        application_id: {
                            type: 'string',
                            description: 'Application ID for the interview'
                        },
                        interview_id: {
                            type: 'string',
                            description: 'Interview template ID'
                        },
                        start: {
                            type: 'string',
                            description: 'Interview start time (ISO 8601 format)'
                        },
                        end: {
                            type: 'string',
                            description: 'Interview end time (ISO 8601 format)'
                        },
                        location: {
                            type: 'string',
                            description: 'Interview location'
                        },
                        video_conferencing_url: {
                            type: 'string',
                            description: 'Video conference URL'
                        },
                        external_event_id: {
                            type: 'string',
                            description: 'External calendar event ID'
                        },
                        interviewers: {
                            type: 'array',
                            description: 'Array of interviewer objects with user_id or email and response_status'
                        },
                    },
                    required: ['application_id', 'interview_id', 'start', 'end',]
                }
            },
            {
                name: 'greenhouse_update_scheduled_interview',
                description: 'Update an existing scheduled interview',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Scheduled interview ID'
                        },
                        start: {
                            type: 'string',
                            description: 'Interview start time (ISO 8601 format)'
                        },
                        end: {
                            type: 'string',
                            description: 'Interview end time (ISO 8601 format)'
                        },
                        location: {
                            type: 'string',
                            description: 'Interview location'
                        },
                        video_conferencing_url: {
                            type: 'string',
                            description: 'Video conference URL'
                        },
                        external_event_id: {
                            type: 'string',
                            description: 'External calendar event ID'
                        },
                        interviewers: {
                            type: 'array',
                            description: 'Array of interviewer objects with user_id or email and response_status'
                        },
                    },
                    required: ['id',]
                }
            },
            {
                name: 'greenhouse_delete_scheduled_interview',
                description: 'Delete a scheduled interview',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Scheduled interview ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_get_application_interviews',
                description: 'Get all scheduled interviews for a specific application',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_list_offers',
                description: 'List all offers with optional filtering',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                        created_before: {
                            type: 'string',
                            description: 'Return offers created before this date (ISO 8601 format)'
                        },
                        created_after: {
                            type: 'string',
                            description: 'Return offers created after this date (ISO 8601 format)'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_offer',
                description: 'Retrieve details about a specific offer',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Offer ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_get_current_offer',
                description: 'Get the current offer for a specific application',
                inputSchema: {
                    type: 'object',
                    properties: {
                        application_id: {
                            type: 'string',
                            description: 'Application ID'
                        },
                    },
                    required: ['application_id']
                }
            },
            {
                name: 'greenhouse_list_scorecards',
                description: 'List all scorecards with optional filtering',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                        created_before: {
                            type: 'string',
                            description: 'Return scorecards created before this date (ISO 8601 format)'
                        },
                        created_after: {
                            type: 'string',
                            description: 'Return scorecards created after this date (ISO 8601 format)'
                        },
                        updated_before: {
                            type: 'string',
                            description: 'Return scorecards updated before this date (ISO 8601 format)'
                        },
                        updated_after: {
                            type: 'string',
                            description: 'Return scorecards updated after this date (ISO 8601 format)'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_scorecard',
                description: 'Retrieve details about a specific scorecard',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Scorecard ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_list_users',
                description: 'List all users in the organization',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                        created_before: {
                            type: 'string',
                            description: 'Return users created before this date (ISO 8601 format)'
                        },
                        created_after: {
                            type: 'string',
                            description: 'Return users created after this date (ISO 8601 format)'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_user',
                description: 'Retrieve details about a specific user',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'User ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_create_user',
                description: 'Create a new user in the organization',
                inputSchema: {
                    type: 'object',
                    properties: {
                        first_name: {
                            type: 'string',
                            description: 'User's first name'
                        },
                        last_name: {
                            type: 'string',
                            description: 'User's last name'
                        },
                        email: {
                            type: 'string',
                            description: 'User's email address'
                        },
                        send_email_invite: {
                            type: 'boolean',
                            description: 'Whether to send email invitation'
                        },
                        employee_id: {
                            type: 'string',
                            description: 'Employee ID'
                        },
                        office_ids: {
                            type: 'array',
                            description: 'Array of office IDs'
                        },
                        department_ids: {
                            type: 'array',
                            description: 'Array of department IDs'
                        },
                        custom_fields: {
                            type: 'array',
                            description: 'Array of custom field objects with name_key/id and value'
                        },
                    },
                    required: ['first_name', 'last_name', 'email',]
                }
            },
            {
                name: 'greenhouse_list_departments',
                description: 'List all departments in the organization',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_department',
                description: 'Retrieve details about a specific department',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Department ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_list_offices',
                description: 'List all offices in the organization',
                inputSchema: {
                    type: 'object',
                    properties: {
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                    },
                    required: []
                }
            },
            {
                name: 'greenhouse_get_office',
                description: 'Retrieve details about a specific office',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Office ID'
                        },
                    },
                    required: ['id']
                }
            },
            {
                name: 'greenhouse_get_activity_feed',
                description: 'Get activity feed for a candidate including notes, emails, and activities',
                inputSchema: {
                    type: 'object',
                    properties: {
                        id: {
                            type: 'string',
                            description: 'Candidate ID'
                        },
                        per_page: {
                            type: 'number',
                            description: 'Number of results per page (max 500, default 100)'
                        },
                        page: {
                            type: 'number',
                            description: 'Page number for pagination'
                        },
                    },
                    required: ['id',]
                }
            }
        ];
    }
    canHandle(toolName) {
        const supportedTools = [
            'greenhouse_list_applications',
            'greenhouse_get_application',
            'greenhouse_create_application',
            'greenhouse_update_application',
            'greenhouse_move_application',
            'greenhouse_transfer_application',
            'greenhouse_reject_application',
            'greenhouse_hire_application',
            'greenhouse_convert_prospect',
            'greenhouse_list_candidates',
            'greenhouse_get_candidate',
            'greenhouse_create_candidate',
            'greenhouse_update_candidate',
            'greenhouse_delete_candidate',
            'greenhouse_list_jobs',
            'greenhouse_get_job',
            'greenhouse_create_job',
            'greenhouse_update_job',
            'greenhouse_get_job_post',
            'greenhouse_list_job_stages',
            'greenhouse_get_job_stage',
            'greenhouse_list_scheduled_interviews',
            'greenhouse_get_scheduled_interview',
            'greenhouse_create_scheduled_interview',
            'greenhouse_update_scheduled_interview',
            'greenhouse_delete_scheduled_interview',
            'greenhouse_get_application_interviews',
            'greenhouse_list_offers',
            'greenhouse_get_offer',
            'greenhouse_get_current_offer',
            'greenhouse_list_scorecards',
            'greenhouse_get_scorecard',
            'greenhouse_list_users',
            'greenhouse_get_user',
            'greenhouse_create_user',
            'greenhouse_list_departments',
            'greenhouse_get_department',
            'greenhouse_list_offices',
            'greenhouse_get_office',
            'greenhouse_get_activity_feed'
        ];
        return supportedTools.includes(toolName);
    }
    async executeTool(name, args) {
        const startTime = Date.now();
        this.logger.logToolStart(name, args);
        await this.ensureInitialized();
        // Validate tool is supported
        if (!this.canHandle(name)) {
            this.logger.error('TOOL_ERROR', 'Unknown tool requested', {
                tool: name,
                supportedTools: ['greenhouse_list_applications', 'greenhouse_get_application', 'greenhouse_create_application', 'greenhouse_update_application', 'greenhouse_move_application', 'greenhouse_transfer_application', 'greenhouse_reject_application', 'greenhouse_hire_application', 'greenhouse_convert_prospect', 'greenhouse_list_candidates', 'greenhouse_get_candidate', 'greenhouse_create_candidate', 'greenhouse_update_candidate', 'greenhouse_delete_candidate', 'greenhouse_list_jobs', 'greenhouse_get_job', 'greenhouse_create_job', 'greenhouse_update_job', 'greenhouse_get_job_post', 'greenhouse_list_job_stages', 'greenhouse_get_job_stage', 'greenhouse_list_scheduled_interviews', 'greenhouse_get_scheduled_interview', 'greenhouse_create_scheduled_interview', 'greenhouse_update_scheduled_interview', 'greenhouse_delete_scheduled_interview', 'greenhouse_get_application_interviews', 'greenhouse_list_offers', 'greenhouse_get_offer', 'greenhouse_get_current_offer', 'greenhouse_list_scorecards', 'greenhouse_get_scorecard', 'greenhouse_list_users', 'greenhouse_get_user', 'greenhouse_create_user', 'greenhouse_list_departments', 'greenhouse_get_department', 'greenhouse_list_offices', 'greenhouse_get_office', 'greenhouse_get_activity_feed']
            });
            throw new Error(`Unknown tool: ${name}`);
        }
        // Validate required parameters
        this.logger.debug('PARAM_VALIDATION', 'Validating tool parameters', {
            tool: name,
            providedArgs: Object.keys(args || {})
        });
        try {
            let result;
            switch (name) {
                case 'greenhouse_list_applications':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_applications',
                        clientMethod: 'listApplications'
                    });
                    result = await this.client.listApplications(args);
                    break;
                case 'greenhouse_get_application':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_application',
                        clientMethod: 'getApplication'
                    });
                    result = await this.client.getApplication(args);
                    break;
                case 'greenhouse_create_application':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_create_application',
                        clientMethod: 'createApplication'
                    });
                    result = await this.client.createApplication(args);
                    break;
                case 'greenhouse_update_application':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_update_application',
                        clientMethod: 'updateApplication'
                    });
                    result = await this.client.updateApplication(args);
                    break;
                case 'greenhouse_move_application':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_move_application',
                        clientMethod: 'moveApplication'
                    });
                    result = await this.client.moveApplication(args);
                    break;
                case 'greenhouse_transfer_application':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_transfer_application',
                        clientMethod: 'transferApplication'
                    });
                    result = await this.client.transferApplication(args);
                    break;
                case 'greenhouse_reject_application':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_reject_application',
                        clientMethod: 'rejectApplication'
                    });
                    result = await this.client.rejectApplication(args);
                    break;
                case 'greenhouse_hire_application':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_hire_application',
                        clientMethod: 'hireApplication'
                    });
                    result = await this.client.hireApplication(args);
                    break;
                case 'greenhouse_convert_prospect':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_convert_prospect',
                        clientMethod: 'convertProspect'
                    });
                    result = await this.client.convertProspect(args);
                    break;
                case 'greenhouse_list_candidates':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_candidates',
                        clientMethod: 'listCandidates'
                    });
                    result = await this.client.listCandidates(args);
                    break;
                case 'greenhouse_get_candidate':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_candidate',
                        clientMethod: 'getCandidate'
                    });
                    result = await this.client.getCandidate(args);
                    break;
                case 'greenhouse_create_candidate':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_create_candidate',
                        clientMethod: 'createCandidate'
                    });
                    result = await this.client.createCandidate(args);
                    break;
                case 'greenhouse_update_candidate':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_update_candidate',
                        clientMethod: 'updateCandidate'
                    });
                    result = await this.client.updateCandidate(args);
                    break;
                case 'greenhouse_delete_candidate':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_delete_candidate',
                        clientMethod: 'deleteCandidate'
                    });
                    result = await this.client.deleteCandidate(args);
                    break;
                case 'greenhouse_list_jobs':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_jobs',
                        clientMethod: 'listJobs'
                    });
                    result = await this.client.listJobs(args);
                    break;
                case 'greenhouse_get_job':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_job',
                        clientMethod: 'getJob'
                    });
                    result = await this.client.getJob(args);
                    break;
                case 'greenhouse_create_job':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_create_job',
                        clientMethod: 'createJob'
                    });
                    result = await this.client.createJob(args);
                    break;
                case 'greenhouse_update_job':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_update_job',
                        clientMethod: 'updateJob'
                    });
                    result = await this.client.updateJob(args);
                    break;
                case 'greenhouse_get_job_post':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_job_post',
                        clientMethod: 'getJobPost'
                    });
                    result = await this.client.getJobPost(args);
                    break;
                case 'greenhouse_list_job_stages':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_job_stages',
                        clientMethod: 'listJobStages'
                    });
                    result = await this.client.listJobStages(args);
                    break;
                case 'greenhouse_get_job_stage':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_job_stage',
                        clientMethod: 'getJobStage'
                    });
                    result = await this.client.getJobStage(args);
                    break;
                case 'greenhouse_list_scheduled_interviews':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_scheduled_interviews',
                        clientMethod: 'listScheduledInterviews'
                    });
                    result = await this.client.listScheduledInterviews(args);
                    break;
                case 'greenhouse_get_scheduled_interview':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_scheduled_interview',
                        clientMethod: 'getScheduledInterview'
                    });
                    result = await this.client.getScheduledInterview(args);
                    break;
                case 'greenhouse_create_scheduled_interview':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_create_scheduled_interview',
                        clientMethod: 'createScheduledInterview'
                    });
                    result = await this.client.createScheduledInterview(args);
                    break;
                case 'greenhouse_update_scheduled_interview':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_update_scheduled_interview',
                        clientMethod: 'updateScheduledInterview'
                    });
                    result = await this.client.updateScheduledInterview(args);
                    break;
                case 'greenhouse_delete_scheduled_interview':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_delete_scheduled_interview',
                        clientMethod: 'deleteScheduledInterview'
                    });
                    result = await this.client.deleteScheduledInterview(args);
                    break;
                case 'greenhouse_get_application_interviews':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_application_interviews',
                        clientMethod: 'getApplicationInterviews'
                    });
                    result = await this.client.getApplicationInterviews(args);
                    break;
                case 'greenhouse_list_offers':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_offers',
                        clientMethod: 'listOffers'
                    });
                    result = await this.client.listOffers(args);
                    break;
                case 'greenhouse_get_offer':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_offer',
                        clientMethod: 'getOffer'
                    });
                    result = await this.client.getOffer(args);
                    break;
                case 'greenhouse_get_current_offer':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_current_offer',
                        clientMethod: 'getCurrentOffer'
                    });
                    result = await this.client.getCurrentOffer(args);
                    break;
                case 'greenhouse_list_scorecards':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_scorecards',
                        clientMethod: 'listScorecards'
                    });
                    result = await this.client.listScorecards(args);
                    break;
                case 'greenhouse_get_scorecard':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_scorecard',
                        clientMethod: 'getScorecard'
                    });
                    result = await this.client.getScorecard(args);
                    break;
                case 'greenhouse_list_users':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_users',
                        clientMethod: 'listUsers'
                    });
                    result = await this.client.listUsers(args);
                    break;
                case 'greenhouse_get_user':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_user',
                        clientMethod: 'getUser'
                    });
                    result = await this.client.getUser(args);
                    break;
                case 'greenhouse_create_user':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_create_user',
                        clientMethod: 'createUser'
                    });
                    result = await this.client.createUser(args);
                    break;
                case 'greenhouse_list_departments':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_departments',
                        clientMethod: 'listDepartments'
                    });
                    result = await this.client.listDepartments(args);
                    break;
                case 'greenhouse_get_department':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_department',
                        clientMethod: 'getDepartment'
                    });
                    result = await this.client.getDepartment(args);
                    break;
                case 'greenhouse_list_offices':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_list_offices',
                        clientMethod: 'listOffices'
                    });
                    result = await this.client.listOffices(args);
                    break;
                case 'greenhouse_get_office':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_office',
                        clientMethod: 'getOffice'
                    });
                    result = await this.client.getOffice(args);
                    break;
                case 'greenhouse_get_activity_feed':
                    this.logger.debug('TOOL_EXECUTE', 'Calling client method', {
                        tool: 'greenhouse_get_activity_feed',
                        clientMethod: 'getActivityFeed'
                    });
                    result = await this.client.getActivityFeed(args);
                    break;
                default:
                    throw new Error(`Unknown tool: ${name}`);
            }
            const duration = Date.now() - startTime;
            this.logger.logToolSuccess(name, duration, result);
            // Return raw result for non-OAuth templates
            return result;
        }
        catch (error) {
            const duration = Date.now() - startTime;
            const errorMessage = error instanceof Error ? error.message : String(error);
            this.logger.logToolError(name, error, duration, args);
            throw error;
        }
    }
}
//# sourceMappingURL=greenhouse-tools.js.map