UNPKG

lattice-hq-mcp-server

Version:

MCP Server for Lattice HQ API - Access goals, users, reviews, and feedback

410 lines (409 loc) 13.5 kB
export const getUsersTool = { name: "lattice_get_users", description: "Get all users in the organization", inputSchema: { type: "object", properties: {}, }, }; export const getUserTool = { name: "lattice_get_user", description: "Get details of a specific user by ID", inputSchema: { type: "object", required: ["user_id"], properties: { user_id: { type: "string", description: "The ID of the user to retrieve", }, }, }, }; export const getUserDirectReportsTool = { name: "lattice_get_user_direct_reports", description: "Get direct reports for a specific user", inputSchema: { type: "object", required: ["user_id"], properties: { user_id: { type: "string", description: "The ID of the user whose direct reports to retrieve", }, }, }, }; export const getGoalsTool = { name: "lattice_get_goals", description: "Get all goals in the organization", inputSchema: { type: "object", properties: {}, }, }; export const getGoalTool = { name: "lattice_get_goal", description: "Get details of a specific goal by ID", inputSchema: { type: "object", required: ["goal_id"], properties: { goal_id: { type: "string", description: "The ID of the goal to retrieve", }, }, }, }; export const getUserGoalsTool = { name: "lattice_get_user_goals", description: "Get all goals for a specific user", inputSchema: { type: "object", required: ["user_id"], properties: { user_id: { type: "string", description: "The ID of the user whose goals to retrieve", }, }, }, }; export const getReviewCyclesTool = { name: "lattice_get_review_cycles", description: "Get all review cycles in the organization", inputSchema: { type: "object", properties: {}, }, }; export const getReviewCycleTool = { name: "lattice_get_review_cycle", description: "Get details of a specific review cycle by ID", inputSchema: { type: "object", required: ["cycle_id"], properties: { cycle_id: { type: "string", description: "The ID of the review cycle to retrieve", }, }, }, }; export const getReviewCycleRevieweesTool = { name: "lattice_get_review_cycle_reviewees", description: "Get all reviewees for a specific review cycle", inputSchema: { type: "object", required: ["cycle_id"], properties: { cycle_id: { type: "string", description: "The ID of the review cycle", }, }, }, }; export const getFeedbacksTool = { name: "lattice_get_feedbacks", description: "Get all feedback in the organization", inputSchema: { type: "object", properties: {}, }, }; export const getFeedbackTool = { name: "lattice_get_feedback", description: "Get details of a specific feedback by ID", inputSchema: { type: "object", required: ["feedback_id"], properties: { feedback_id: { type: "string", description: "The ID of the feedback to retrieve", }, }, }, }; export const getDepartmentsTool = { name: "lattice_get_departments", description: "Get all departments in the organization", inputSchema: { type: "object", properties: {}, }, }; export const getDepartmentTool = { name: "lattice_get_department", description: "Get details of a specific department by ID", inputSchema: { type: "object", required: ["department_id"], properties: { department_id: { type: "string", description: "The ID of the department to retrieve", }, }, }, }; export const getUpdatesTool = { name: "lattice_get_updates", description: "Get all updates in the organization", inputSchema: { type: "object", properties: {}, }, }; export const getUpdateTool = { name: "lattice_get_update", description: "Get details of a specific update by ID", inputSchema: { type: "object", required: ["update_id"], properties: { update_id: { type: "string", description: "The ID of the update to retrieve", }, }, }, }; export const getMeTool = { name: "lattice_get_me", description: "Get current user information", inputSchema: { type: "object", properties: {}, }, }; // Export all tools export const allTools = [ getUsersTool, getUserTool, getUserDirectReportsTool, getGoalsTool, getGoalTool, getUserGoalsTool, getReviewCyclesTool, getReviewCycleTool, getReviewCycleRevieweesTool, getFeedbacksTool, getFeedbackTool, getDepartmentsTool, getDepartmentTool, getUpdatesTool, getUpdateTool, getMeTool, ]; // Create tools with handlers export function createLatticeTools(client) { return [ { name: "lattice_get_users", description: "Get all users in the organization", inputSchema: getUsersTool.inputSchema, handler: async (args) => { const response = await client.getUsers(); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_user", description: "Get details of a specific user by ID", inputSchema: getUserTool.inputSchema, handler: async (args) => { if (!args.user_id) { throw new Error("user_id is required"); } const response = await client.getUser(args.user_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_user_direct_reports", description: "Get direct reports for a specific user", inputSchema: getUserDirectReportsTool.inputSchema, handler: async (args) => { if (!args.user_id) { throw new Error("user_id is required"); } const response = await client.getUserDirectReports(args.user_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_goals", description: "Get all goals in the organization", inputSchema: getGoalsTool.inputSchema, handler: async (args) => { const response = await client.getGoals(); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_goal", description: "Get details of a specific goal by ID", inputSchema: getGoalTool.inputSchema, handler: async (args) => { if (!args.goal_id) { throw new Error("goal_id is required"); } const response = await client.getGoal(args.goal_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_user_goals", description: "Get all goals for a specific user", inputSchema: getUserGoalsTool.inputSchema, handler: async (args) => { if (!args.user_id) { throw new Error("user_id is required"); } const response = await client.getUserGoals(args.user_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_review_cycles", description: "Get all review cycles in the organization", inputSchema: getReviewCyclesTool.inputSchema, handler: async (args) => { const response = await client.getReviewCycles(); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_review_cycle", description: "Get details of a specific review cycle by ID", inputSchema: getReviewCycleTool.inputSchema, handler: async (args) => { if (!args.cycle_id) { throw new Error("cycle_id is required"); } const response = await client.getReviewCycle(args.cycle_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_review_cycle_reviewees", description: "Get all reviewees for a specific review cycle", inputSchema: getReviewCycleRevieweesTool.inputSchema, handler: async (args) => { if (!args.cycle_id) { throw new Error("cycle_id is required"); } const response = await client.getReviewCycleReviewees(args.cycle_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_feedbacks", description: "Get all feedback in the organization", inputSchema: getFeedbacksTool.inputSchema, handler: async (args) => { const response = await client.getFeedbacks(); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_feedback", description: "Get details of a specific feedback by ID", inputSchema: getFeedbackTool.inputSchema, handler: async (args) => { if (!args.feedback_id) { throw new Error("feedback_id is required"); } const response = await client.getFeedback(args.feedback_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_departments", description: "Get all departments in the organization", inputSchema: getDepartmentsTool.inputSchema, handler: async (args) => { const response = await client.getDepartments(); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_department", description: "Get details of a specific department by ID", inputSchema: getDepartmentTool.inputSchema, handler: async (args) => { if (!args.department_id) { throw new Error("department_id is required"); } const response = await client.getDepartment(args.department_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_updates", description: "Get all updates in the organization", inputSchema: getUpdatesTool.inputSchema, handler: async (args) => { const response = await client.getUpdates(); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_update", description: "Get details of a specific update by ID", inputSchema: getUpdateTool.inputSchema, handler: async (args) => { if (!args.update_id) { throw new Error("update_id is required"); } const response = await client.getUpdate(args.update_id); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, { name: "lattice_get_me", description: "Get current user information", inputSchema: getMeTool.inputSchema, handler: async (args) => { const response = await client.getMe(); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], }; }, }, ]; }