pms-analysis-reports-mcp-server
Version:
PMS analysis reports server handling maintenance reports, equipment analysis, compliance tracking, and performance metrics with ERP access for data extraction
104 lines • 5.56 kB
JavaScript
import { getTypesenseClient } from "../../utils/typesense.js";
import { combined_mongotools_with_single_category_mapping, combined_mongotools_with_grouped_category_mapping } from "../../utils/helper_functions.js";
import { logger } from "../../index.js";
export class MongodbToolsHandler {
constructor() {
this.typesenseClient = getTypesenseClient();
}
async getVesselPmsInformation(args) {
logger.info("getVesselPmsInformation called", args);
try {
// Initialize database connection
const qaDbName = process.env.QA_DB_NAME || process.env.qaDbName || '';
const qaMongoUri = process.env.QA_MONGO_URI || process.env.qaMongoUri || '';
// Use the combined helper function for single category mapping
const result = await combined_mongotools_with_single_category_mapping(args, [7, 30, 112, 116, 128, 177, 261], // Allowed questions for PMS
"get_vessel_pms_information", {
7: "Aux Engine Maintenance Status Summary",
30: "Compressor Maintenance Status Summary",
112: "Main Engine Maintenance Status Summary",
116: "PMS Summary",
128: "Purifier Maintenance Status Summary",
177: "Critical Spare List Compliance",
261: "Saturday routine jobs (Weekly LSA/FFA jobs) as per Ship Palm (ERP system)"
}, qaDbName, qaMongoUri);
return result;
}
catch (error) {
logger.error("Error in getVesselPmsInformation", { error });
throw new Error(`Error retrieving PMS information: ${error instanceof Error ? error.message : String(error)}`);
}
}
async getVesselFormsInformation(args) {
logger.info("getVesselFormsInformation called", args);
try {
// Initialize database connection
const qaDbName = process.env.QA_DB_NAME || process.env.qaDbName || '';
const qaMongoUri = process.env.QA_MONGO_URI || process.env.qaMongoUri || '';
// Use the combined helper function for grouped category mapping
const result = await combined_mongotools_with_grouped_category_mapping(args, [
"forms_related_to_main_engine",
"forms_related_to_auxiliary_engine",
"forms_related_to_lubrication_analysis",
"forms_related_to_inventory",
"compliance_reporting",
"remaining_forms"
], {
"forms_related_to_main_engine": [67, 68, 69, 70, 76, 113],
"forms_related_to_auxiliary_engine": [1, 2, 3, 4, 8, 71, 77],
"forms_related_to_lubrication_analysis": [72, 74],
"forms_related_to_inventory": [75, 79],
"compliance_reporting": [65, 66, 80],
"remaining_forms": [10, 73, 78, 231]
}, "get_vessel_forms_information", qaDbName, qaMongoUri);
return result;
}
catch (error) {
logger.error("Error in getVesselFormsInformation", { error });
throw new Error(`Error retrieving vessel forms information: ${error instanceof Error ? error.message : String(error)}`);
}
}
async getVesselShoreAnalysisInformation(args) {
logger.info("getVesselShoreAnalysisInformation called", args);
try {
// Initialize database connection
const qaDbName = process.env.QA_DB_NAME || process.env.qaDbName || '';
const qaMongoUri = process.env.QA_MONGO_URI || process.env.qaMongoUri || '';
// Use the combined helper function for single category mapping
const result = await combined_mongotools_with_single_category_mapping(args, [83, 103], // Allowed questions for Shore Analysis
"get_vessel_shore_analysis_information", {
83: "Latest Fuel Oil Bunker Details",
103: "Lube Oil Shore Analysis Status"
}, qaDbName, qaMongoUri);
return result;
}
catch (error) {
logger.error("Error in getVesselShoreAnalysisInformation", { error });
throw new Error(`Error retrieving shore analysis information: ${error instanceof Error ? error.message : String(error)}`);
}
}
async getFleetPmsFormsFuelInformation(args) {
logger.info("getFleetPmsFormsFuelInformation called", args);
try {
// Initialize database connection
const qaDbName = process.env.QA_DB_NAME || process.env.qaDbName || '';
const qaMongoUri = process.env.QA_MONGO_URI || process.env.qaMongoUri || '';
// Use the combined helper function for grouped category mapping
const result = await combined_mongotools_with_grouped_category_mapping(args, [
"fleet_forms_compliance",
"fleet_maintenance_overview",
"fleet_fuel_analysis"
], {
"fleet_forms_compliance": [81],
"fleet_maintenance_overview": [110, 114],
"fleet_fuel_analysis": [209]
}, "get_fleet_pms_forms_fuel_information", qaDbName, qaMongoUri);
return result;
}
catch (error) {
logger.error("Error in getFleetPmsFormsFuelInformation", { error });
throw new Error(`Error retrieving fleet PMS forms fuel information: ${error instanceof Error ? error.message : String(error)}`);
}
}
}
//# sourceMappingURL=mongofetchTools.js.map