UNPKG

purchase-mcp-server

Version:
543 lines (452 loc) 40.5 kB
import { z } from "zod"; export const toolDefinitions = { universal_purchase_search: { name: "universal_purchase_search", description: `Query the purchase database using structured parameters to retrieve and analyze purchase requisition and purchase order data from Typesense. This tool constructs search queries internally with predefined field validation for security and consistency. ## PARAMETER USAGE - **query_by**: Comma-separated field names for full-text search (e.g., "vesselName,prDescription,vendorOrSupplierName") - **q**: Search query string for full-text search (e.g., "engine parts") - **filter_by**: Filtering conditions using Typesense syntax (e.g., "purchaseRequisitionStatus:APPROVED && imo:9000000") - **sort_by**: Field name with direction for sorting (e.g., "purchaseRequisitionDate:desc,invoiceAmount:asc") - **page**: Page number for pagination (default: 1) - **per_page**: Results per page, up to 250 (default: 50) ## DATE HANDLING **IMPORTANT**: For date fields (date, purchaseRequisitionDate, purchaseOrderIssuedDate, orderReadinessDate), always use **yyyy-mm-dd** format in filter_by parameter. **Examples**: - ✅ CORRECT: "purchaseRequisitionDate:>=2024-01-01" - ✅ CORRECT: "orderReadinessDate:<=2024-12-31" - ❌ WRONG: "purchaseRequisitionDate:>=01-01-2024" (dd-mm-yyyy format) ## TYPESENSE DATABASE SCHEMA - PURCHASE TABLE The purchase table contains comprehensive purchase requisition and purchase order data with 50+ fields organized into the following categories: ### 1. VESSEL INFORMATION (3 fields) Information about the vessel associated with purchase requisitions and orders. | Field Name | Data Type | Description | |------------|-----------|-------------| | vesselId | string | Details related to the vessel | | imo | int64 | IMO number of the vessel only use for filter not in queryby argument | | vesselName | string | Name of the vessel | ### 2. PURCHASE REQUISITION INFORMATION (8 fields) Core purchase requisition details and status. | Field Name | Data Type | Description | |------------|-----------|-------------| | purchaseRequisitionDate | string | When filtering use yyyy-mm-dd format | | prDescription | string | Descriptive text field | | purchaseRequisitionStatus | string | Status of purchase requisition (PR). Values: DRAFT, APPROVED, SENT FOR QUOTE, AWAITING APPROVAL, QUOTED, PO APPROVED, PO GENERATED, ORDERED, CLOSED, CANCELLED, PARTIALLY RECEIVED, UNDER AMENDMENT | | purchaseRequisitionNumber | string | Purchase Requisition (PR) Number | | purchaseRequisitionLink | string | URL or hyperlink to supporting resource | | purchaseRequisitionType | string | Type of purchase requisition (PR). Values: ANTI-PIRACY ITEMS, CHARTS PUBLICATIONS, FLAG LOG BOOKS, FUEL ADDITIVES, GAS MEASUREMENT EQUIPMENTS, GASES WELDING, GENERAL STORES, LICENSE, LSA-FFA, LUBE OILS GREASES, MAINTENANCE CHEMICALS, PAINTS THINNERS, SYNERGY PPE KIT, PERSONNEL PROTECTION, SAFETY, SCRUBBER BWTS CHEMICALS, MARPOL SEALS, SERVICE, SPARE PARTS, PRINTED STATIONARY KITS, STORE, TANK/HOLD CLEANING CHEMICALS | | purchaseRequisitionSummary | string | Descriptive text field | | purchaseRequisitionDescription | string | What a particular purchase requisition (PR) is about | ### 3. PURCHASE ORDER INFORMATION (10 fields) Purchase order details, status, and tracking. | Field Name | Data Type | Description | |------------|-----------|-------------| | poValue | string | Monetary value field | | purchaseOrderIssuedDate | string | When purchase order or PO was issued. When filtering use yyyy-mm-dd format | | purchaseOrderNumber | string | Unique identifier | | purchaseOrderLink | string | URL or hyperlink to supporting resource | | purchaseOrderStatus | string | Status of purchase order. Values: CLOSED, WITH FORWARDER, CANCELLED, ORDERED, AWAITING APPROVAL, UNDER AMENDMENT, APPROVED, DRAFT, REJECTED, QUOTED | | purchaseOrderAmount | float | Amount for which purchase order or PO is issued. Use > < = operators | | purchaseOrderStage | string | Whether a purchase order (PO) is open or close. Values: OPEN, CLOSE | | poCreatedBy | string | Name of an entity or person | | orderType | string | Type of order for a purchase order (PO). Values: OL, OF | ### 4. VENDOR AND SUPPLIER INFORMATION (2 fields) Supplier and vendor details. | Field Name | Data Type | Description | |------------|-----------|-------------| | vendorOrSupplierName | string | Name of the supplier who will be supplying that purchase order (PO) | | accountCode | string | Account code under which a particular requisition (PR) is raised | ### 5. INVOICE INFORMATION (7 fields) Invoice status, amounts, and approval details. | Field Name | Data Type | Description | |------------|-----------|-------------| | invoiceStatus | string | Status of invoice for a Purchase order. Values: TRANSFERRED, WAITING, REJECTED, READYFORTRANSFER, NEW, ONHOLD, NOT RECEIVED | | invoiceValue | string | Monetary value field | | invoiceAmount | float | Amount paid as per the invoice for a purchase order or PO. Use > < = operators | | invoiceApproverName | string | Name of an entity or person | | scanID | int64 | Scan ID for an invoice | | scanIDLink | string | URL or hyperlink to supporting resource | ### 6. ORDER MANAGEMENT (6 fields) Order priority, readiness, and logistics information. | Field Name | Data Type | Description | |------------|-----------|-------------| | orderReadinessDate | string | Cutoff date for when purchase orders are expected to be ready with the vendor and can be shipped to vessel. This filter should be used along with two other filters as poStatus as ordered and poStage as open. Use a date comparison symbol to filter POs ready before, or after a specific date. When filtering use yyyy-mm-dd format | | orderPriority | string | Priority of the purchase requisition or order. Values: DEFECT, ROUTINE MAINTENANCE STOCK, NORMAL, RECOMMENDED STOCK, URGENT, OTHERS, DRY DOCK, AUDIT | | forwarderName | string | PRs or POs which are with a particular logistic forwarder. Values: AQUARIUS, MARINE TRANS, ONE LOOP | | forwarderRemarks | string | Descriptive text field | | warehouseLocation | string | General purpose field | ### 7. QUOTATION AND CURRENCY (3 fields) Quotation and currency information. | Field Name | Data Type | Description | |------------|-----------|-------------| | qtcNo | string | Unique identifier | | qtcLink | string | URL or hyperlink to supporting resource | | currencyCode | string | Currency in which purchase order or invoice is issued. Values like USD, SGD etc | ### 8. CARGO AND SHIPPING (3 fields) Cargo type and shipping details. | Field Name | Data Type | Description | |------------|-----------|-------------| | cargoType | string | Type of cargo for a purchase order (PO). Values: DG, NORMAL | | weight | int64 | Weight value (numeric) | | directPo | bool | Whether the purchase order is a Direct PO or not. Values: true, false | ### 9. STATUS FLAGS AND INDICATORS (6 fields) Boolean flags for various purchase states. | Field Name | Data Type | Description | |------------|-----------|-------------| | poInvoiceDiscrepency | bool | Purchase order for which PO and invoice amount is not matching. Values: true, false | | isNewPurchaseRequisition | bool | Whether the purchase requisition (PR) raised is new or not. Values: true, false | | isPurchaseRequisitionNotOrdered | bool | Whether the purchase requisition (PR) is ordered or not. Values: true, false | | isPurchaseRequisitionSupplied | bool | Whether the purchase requisition (PR) has been supplied to vessel or not. Values: true, false | | isPurchaseOrderReady | bool | Whether the purchase order (PO) is ready to be shipped or not. Values: true, false | ### 10. ADDITIONAL INFORMATION (6 fields) Miscellaneous fields and identifiers. | Field Name | Data Type | Description | |------------|-----------|-------------| | prType | string | Type or category field | | purchaseOverviewUpdate | string | Descriptive text field | | docId | string | Unique identifier | | fleetManagerId | string | Unique identifier | | technicalSuperintendentId | string | Unique identifier | | ownerId | string[] | List of owner identifiers | ### 11. SYSTEM FIELD (1 field) System-generated identifier. | Field Name | Data Type | Description | |------------|-----------|-------------| | _id | string | Internal document ID used for indexing and search | ## USAGE EXAMPLES **Basic Search Queries:** - universal_purchase_search(query_by="vesselName,prDescription", q="engine parts", per_page=100) - universal_purchase_search(filter_by="purchaseRequisitionStatus:APPROVED", sort_by="purchaseRequisitionDate:desc") **Advanced Filtering:** - universal_purchase_search(filter_by="imo:9000000 && purchaseRequisitionStatus:APPROVED", sort_by="invoiceAmount:desc") - universal_purchase_search(filter_by="orderPriority:URGENT && purchaseOrderStage:OPEN", query_by="vesselName", q="*") **Date Range Filtering:** - universal_purchase_search(filter_by="purchaseRequisitionDate:>=2024-01-01 && purchaseRequisitionDate:<=2024-12-31") - universal_purchase_search(filter_by="orderReadinessDate:<2024-08-15 && purchaseOrderStatus:ORDERED && purchaseOrderStage:OPEN") **Complex Queries:** - universal_purchase_search(query_by="vendorOrSupplierName,prDescription", q="pump", filter_by="invoiceAmount:>1000 && currencyCode:USD", sort_by="invoiceAmount:desc") This tool enables advanced analytics, reporting, and data exploration for purchase management operations.`, schema: { query_by: z.string().optional().describe("Comma-separated list of field names to search in for full-text search. Only use string fields that are useful for text-based queries."), q: z.string().default("*").describe("Search query string for full-text search. Use '*' for wildcard searches or specific terms. Example: 'engine parts' or 'pump*'"), filter_by: z.string().optional().describe("Filter conditions using Typesense syntax. Use field:value format with operators like :, :>, :<, :>=, :<=. Combine with && (AND) or || (OR). Example: 'purchaseRequisitionStatus:APPROVED && imo:9000000'"), sort_by: z.string().default("relevance").describe("Comma-separated list of fields with sort direction. Format: 'field:asc' or 'field:desc'. Example: 'purchaseRequisitionDate:desc,invoiceAmount:asc'"), page: z.number().min(1).default(1).describe("Page number for pagination. Default: 1"), per_page: z.number().min(1).max(250).default(50).describe("Number of results per page. Maximum: 250, Default: 50"), } }, universal_budget_search: { name: "universal_budget_search", description: `Query the budget database using structured parameters to retrieve and analyze vessel budget and expense data from Typesense. This tool constructs search queries internally with predefined field validation for security and consistency. ## PARAMETER USAGE - **query_by**: Comma-separated field names for full-text search (e.g., "vesselName,category") - **q**: Search query string for full-text search (e.g., "crew wages") - **filter_by**: Filtering conditions using Typesense syntax (e.g., "group:OPEX && period:Current && imo:9000000") - **sort_by**: Field name with direction for sorting (e.g., "budgetAmount:desc,date:asc") - **page**: Page number for pagination (default: 1) - **per_page**: Results per page, up to 250 (default: 50) ## DATE HANDLING **IMPORTANT**: For date field, always use **yyyy-mm-dd** format in filter_by parameter. **Examples**: - ✅ CORRECT: "date:>=2024-01-01" - ✅ CORRECT: "date:<=2024-12-31" - ❌ WRONG: "date:>=01-01-2024" (dd-mm-yyyy format) ## TYPESENSE DATABASE SCHEMA - BUDGET TABLE The budget table contains comprehensive vessel budget and expense data with 8 fields organized into the following categories: ### 1. VESSEL INFORMATION (2 fields) Information about the vessel associated with budget and expense data. | Field Name | Data Type | Description | |------------|-----------|-------------| | imo | int64 | IMO number of the vessel only use for filter not in queryby argument | | vesselName | string | Name of the vessel | ### 2. BUDGET CATEGORIZATION (3 fields) Budget classification and grouping information. | Field Name | Data Type | Description | |------------|-----------|-------------| | category | string | Budget category of vessel. Values: CREW WAGES, CREW EXPENSES, VICTUALLING EXPENSES, STORES, SPARES, LUBE OIL CONSUMPTION, REPAIRS & MAINTENANCE, MANAGEMENT FEES, MISCELLANEOUS, ADMINISTRATIVE EXPENSES, INSURANCE, DRYDOCKING EXPENSES, NON-BUDGETED EXPENSES, P&I/H&M EXPENSES, VOYAGE/CHARTERERS EXPENSES, CAPITAL EXPENDITURE, EXTRA ORDINARY ITEMS, VESSEL UPGRADING COSTS, LAY-UP COSTS, PRE-DELIVERY EXPENSES | | group | string | Group of the budget category. OPEX=Operating Expenses, NB=Non-Budgeted, PD=Pre-Delivery, DD=Dry-Docking. Values: OPEX, NB, PD, DD | | period | string | Period of the budget category. Previous=previous period, Current=current period. Values: Previous, Current | ### 3. FINANCIAL DATA (3 fields) Budget amounts, expenses, and date information. | Field Name | Data Type | Description | |------------|-----------|-------------| | budgetAmount | number | Budget amount of the budget category of vessel | | expenseAmount | number | Expense amount of the budget category of vessel | | date | string | Date of the budget&expense category of vessel. When filtering use yyyy-mm-dd format | ## USAGE EXAMPLES **Basic Search Queries:** - universal_budget_search(query_by="vesselName,category", q="crew wages", per_page=100) - universal_budget_search(filter_by="group:OPEX", sort_by="budgetAmount:desc") **Advanced Filtering:** - universal_budget_search(filter_by="imo:9000000 && period:Current", sort_by="expenseAmount:desc") - universal_budget_search(filter_by="category:SPARES && group:OPEX", query_by="vesselName", q="*") **Date Range Filtering:** - universal_budget_search(filter_by="date:>=2024-01-01 && date:<=2024-12-31") - universal_budget_search(filter_by="date:>2024-06-01 && budgetAmount:>50000") **Amount Range Filtering:** - universal_budget_search(filter_by="budgetAmount:>100000", sort_by="budgetAmount:desc") - universal_budget_search(filter_by="expenseAmount:>=10000 && expenseAmount:<=50000") **Complex Queries:** - universal_budget_search(query_by="vesselName", q="engine", filter_by="group:OPEX && budgetAmount:>25000", sort_by="date:desc") This tool enables advanced analytics, reporting, and data exploration for budget management operations.`, schema: { query_by: z.string().optional().describe("Comma-separated list of field names to search in for full-text search. Only use string fields that are useful for text-based queries."), q: z.string().default("*").describe("Search query string for full-text search. Use '*' for wildcard searches or specific terms. Example: 'crew wages' or 'maintenance*'"), filter_by: z.string().optional().describe("Filter conditions using Typesense syntax. Use field:value format with operators like :, :>, :<, :>=, :<=. Combine with && (AND) or || (OR). Example: 'group:OPEX && period:Current && imo:9000000'"), sort_by: z.string().default("relevance").describe("Comma-separated list of fields with sort direction. Format: 'field:asc' or 'field:desc'. Example: 'budgetAmount:desc,date:asc'"), page: z.number().min(1).default(1).describe("Page number for pagination. Default: 1"), per_page: z.number().min(1).max(250).default(50).describe("Number of results per page. Maximum: 250, Default: 50"), } }, universal_expense_search: { name: "universal_expense_search", description: `Query the expense database using structured parameters to retrieve and analyze vessel expense and cost tracking data from Typesense. This tool constructs search queries internally with predefined field validation for security and consistency. ## PARAMETER USAGE - **query_by**: Comma-separated field names for full-text search (e.g., "vesselName,accountDescription,vendor") - **q**: Search query string for full-text search (e.g., "maintenance repairs") - **filter_by**: Filtering conditions using Typesense syntax (e.g., "group:OPEX && expenseCategory:ACTUAL EXPENSES && imo:9000000 && vendor:MarineCorp") - **sort_by**: Field name with direction for sorting (e.g., "expenseDate:desc,expenseAmount:asc") - **page**: Page number for pagination (default: 1) - **per_page**: Results per page, up to 250 (default: 50) ## DATE HANDLING **IMPORTANT**: For expenseDate field, always use **yyyy-mm-dd** format in filter_by parameter. **Examples**: - ✅ CORRECT: "expenseDate:>=2024-01-01" - ✅ CORRECT: "expenseDate:<=2024-12-31" - ❌ WRONG: "expenseDate:>=01-01-2024" (dd-mm-yyyy format) ## TYPESENSE DATABASE SCHEMA - EXPENSE TABLE The expense table contains comprehensive vessel expense and cost tracking data with 11 fields organized into the following categories: ### 1. VESSEL INFORMATION (2 fields) Information about the vessel associated with expense data. | Field Name | Data Type | Description | |------------|-----------|-------------| | imo | int64 | IMO number of the vessel only use for filter not in queryby argument | | vesselName | string | Name of the vessel | ### 2. EXPENSE CLASSIFICATION (3 fields) Expense grouping and categorization information. | Field Name | Data Type | Description | |------------|-----------|-------------| | group | string | Broad expense classification (use only when user explicitly specifies). Values: OPEX, NON BUDGET, DRY DOCKING, PRE DELIVERY | | category | string | Expense sub-category within the chosen group. Values: ADMINISTRATIVE EXPENSES, CAPITAL EXPENDITURE, CREW EXPENSES, CREW WAGES, DRYDOCKING EXPENSES, EXTRA ORDINARY ITEMS, INSURANCE, LAY-UP COSTS, LUBE OIL CONSUMPTION, MANAGEMENT FEES, MISCELLANEOUS, NON-BUDGETED EXPENSES, PI/HM EXPENSES, PRE-DELIVERY EXPENSES, REPAIRS MAINTENANCE, SPARES, STORES, VESSEL UPGRADING COSTS, VICTUALLING EXPENSES, VOYAGE/CHARTERERS EXPENSES | | expenseCategory | string | Classification indicating whether the record is an actual expense or a committed cost. Unless the user specifically asks for committed cost, assume ACTUAL EXPENSES. Values: ACTUAL EXPENSES, COMMITTED COST | ### 3. ACCOUNT INFORMATION (2 fields) Account details and descriptions. | Field Name | Data Type | Description | |------------|-----------|-------------| | accountNo | string | Unique account number where the expense is recorded | | accountDescription | string | Detailed description of the expense within its category (a finer sub-category) | ### 4. VENDOR INFORMATION (1 field) Vendor details for expense tracking. | Field Name | Data Type | Description | |------------|-----------|-------------| | vendor | string | Name of the vendor or supplier who provided the goods/services for this expense | ### 5. FINANCIAL DATA (3 fields) Expense amounts, PO amounts, and date information. | Field Name | Data Type | Description | |------------|-----------|-------------| | expenseDate | string | Date the expense was incurred. When filtering use yyyy-mm-dd format | | expenseAmount | number | Actual amount incurred for a purchase order (PO). Use > < = operators | | poAmount | number | Amount committed for a PO but not yet incurred. Use > < = operators | ## USAGE EXAMPLES **Basic Search Queries:** - universal_expense_search(query_by="vesselName,accountDescription", q="maintenance repairs", per_page=100) - universal_expense_search(filter_by="group:OPEX", sort_by="expenseAmount:desc") - universal_expense_search(query_by="vendor,accountDescription", q="marine equipment", per_page=50) **Advanced Filtering:** - universal_expense_search(filter_by="imo:9000000 && expenseCategory:ACTUAL EXPENSES", sort_by="expenseDate:desc") - universal_expense_search(filter_by="category:SPARES && group:OPEX", query_by="accountDescription", q="*") - universal_expense_search(filter_by="vendor:MarineCorp && expenseAmount:>10000", sort_by="expenseDate:desc") **Date Range Filtering:** - universal_expense_search(filter_by="expenseDate:>=2024-01-01 && expenseDate:<=2024-12-31") - universal_expense_search(filter_by="expenseDate:>2024-06-01 && expenseAmount:>10000") **Amount Range Filtering:** - universal_expense_search(filter_by="expenseAmount:>50000", sort_by="expenseAmount:desc") - universal_expense_search(filter_by="poAmount:>=5000 && poAmount:<=25000") **Category-Specific Queries:** - universal_expense_search(filter_by="expenseCategory:COMMITTED COST", sort_by="poAmount:desc") - universal_expense_search(filter_by="category:CREW WAGES && expenseCategory:ACTUAL EXPENSES") **Vendor-Specific Queries:** - universal_expense_search(query_by="vendor", q="MarineCorp", filter_by="expenseCategory:ACTUAL EXPENSES") - universal_expense_search(filter_by="vendor:TechSupplies && category:SPARES", sort_by="expenseAmount:desc") **Complex Queries:** - universal_expense_search(query_by="vesselName,accountDescription", q="maintenance", filter_by="group:OPEX && expenseAmount:>15000", sort_by="expenseDate:desc") - universal_expense_search(query_by="vendor,accountDescription", q="engine", filter_by="group:OPEX && expenseAmount:>5000", sort_by="expenseDate:desc") This tool enables advanced analytics, reporting, and data exploration for expense management operations.`, schema: { query_by: z.string().optional().describe("Comma-separated list of field names to search in for full-text search. Only use string fields that are useful for text-based queries."), q: z.string().default("*").describe("Search query string for full-text search. Use '*' for wildcard searches or specific terms. Example: 'maintenance repairs' or 'engine*'"), filter_by: z.string().optional().describe("Filter conditions using Typesense syntax. Use field:value format with operators like :, :>, :<, :>=, :<=. Combine with && (AND) or || (OR). Example: 'group:OPEX && expenseCategory:ACTUAL EXPENSES && imo:9000000'"), sort_by: z.string().default("relevance").describe("Comma-separated list of fields with sort direction. Format: 'field:asc' or 'field:desc'. Example: 'expenseDate:desc,expenseAmount:asc'"), page: z.number().min(1).default(1).describe("Page number for pagination. Default: 1"), per_page: z.number().min(1).max(250).default(50).describe("Number of results per page. Maximum: 250, Default: 50"), } }, get_complete_vessel_budget_data: { name: "get_complete_vessel_budget_data", description: "Use this tool to export ALL budget records for a vessel from the budget typesense collection using the export method. This tool retrieves the complete dataset of budget records for comprehensive financial planning, budget variance analysis, or bulk data processing. Optionally filter by date range using date field for specific time periods. Use this when you need: complete budget history analysis, multi-year budget comparisons, comprehensive budget vs actual analysis, or when the user specifically asks for 'all' or 'complete' budget data. Use other budget tools instead when you need quick budget lookups, specific categories, or current period data. Example questions: 'Export all budget data for VESSEL_NAME', 'Get complete budget history for last 2 years for VESSEL_NAME', 'Download all budget records for VESSEL_NAME since 2023'", schema: { imo: z.string().describe("IMO number of the vessel"), start_date: z.string().optional().describe("Optional start date for filtering budget records (YYYY-MM-DD format). Filter will include budget records from this date onwards based on date field"), end_date: z.string().optional().describe("Optional end date for filtering budget records (YYYY-MM-DD format). Filter will include budget records up to this date based on date field"), } }, get_complete_vessel_purchase_requisition_data: { name: "get_complete_vessel_purchase_requisition_data", description: "Use this tool to export ALL purchase requisitions for a vessel from the purchase typesense collection using the export method. Unlike this tool get_vessel_purchase_log_table which is limited to 100 records, this tool retrieves the complete dataset of purchase requisitions for comprehensive analysis, reporting, or bulk data processing. Optionally filter by date range using purchaseRequisitionDate field for specific time periods. Use this when you need: complete purchase history analysis, bulk data export for reporting, comprehensive spend analysis, or when the user specifically asks for 'all' or 'complete' purchase data. Use the table tool instead when you need quick overview, recent transactions, or paginated display. Example questions: 'Export all purchase requisitions for VESSEL_NAME', 'Get complete purchase history for last 6 months for VESSEL_NAME', 'Download all PR data for VESSEL_NAME since MM YYYY", schema: { imo: z.string().describe("IMO number of the vessel"), start_date: z.string().optional().describe("Optional start date for filtering requisitions (YYYY-MM-DD format). Filter will include requisitions from this date onwards based on purchaseRequisitionDate field"), end_date: z.string().optional().describe("Optional end date for filtering requisitions (YYYY-MM-DD format). Filter will include requisitions up to this date based on purchaseRequisitionDate field"), } }, get_complete_vessel_expense_data: { name: "get_complete_vessel_expense_data", description: "Use this tool to export ALL expense records for a vessel from the expense typesense collection using the export method. This tool retrieves the complete dataset of expense records for comprehensive financial analysis, audit reporting, or bulk data processing. Optionally filter by date range using expenseDate field for specific time periods. Use this when you need: complete expense history analysis, financial audit data export, comprehensive cost analysis across time periods, or when the user specifically asks for 'all' or 'complete' expense data. Use other expense tools instead when you need quick lookups, filtered searches, or specific expense categories. Example questions: 'Export all expenses for VESSEL_NAME', 'Get complete expense history for last year for VESSEL_NAME', 'Download all expense data for VESSEL_NAME since March 2024'", schema: { imo: z.string().describe("IMO number of the vessel"), start_date: z.string().optional().describe("Optional start date for filtering expense records (YYYY-MM-DD format). Filter will include expenses from this date onwards based on expenseDate field"), end_date: z.string().optional().describe("Optional end date for filtering expense records (YYYY-MM-DD format). Filter will include expenses up to this date based on expenseDate field"), } }, get_complete_fleet_purchases: { name: "get_complete_fleet_purchases", description: "Export ALL purchase records for an entire fleet in CSV format. The tool performs the following steps: 1) Queries MongoDB common_group_details collection using the provided fleet IMO to get the list of vessel IMO numbers in the fleet, 2) Uses Typesense export to retrieve all purchase requisitions, purchase orders, and procurement data for all vessels in the fleet, 3) Converts the data to CSV format for analysis. This tool is ideal for comprehensive fleet-wide procurement analysis, compliance reporting, and bulk data export. The fleet IMO should be obtained from another MCP server that handles fleet name lookups.", schema: { fleet_imo: z.number().describe("IMO number of the fleet or group (e.g., 1000017 for SMPL DRY fleet). This should be obtained from a fleet lookup service."), start_date: z.string().optional().describe("Optional start date for filtering purchase records (YYYY-MM-DD format). Filter will include purchases from this date onwards based on creation date fields"), end_date: z.string().optional().describe("Optional end date for filtering purchase records (YYYY-MM-DD format). Filter will include purchases up to this date based on creation date fields"), } }, get_complete_fleet_budgets: { name: "get_complete_fleet_budgets", description: "Export ALL budget records for an entire fleet in CSV format. The tool performs the following steps: 1) Queries MongoDB common_group_details collection using the provided fleet IMO to get the list of vessel IMO numbers in the fleet, 2) Uses Typesense export to retrieve all budget data, variance reports, and financial planning information for all vessels in the fleet, 3) Converts the data to CSV format for analysis. This tool is ideal for comprehensive fleet-wide budget analysis, financial reporting, and bulk data export. The fleet IMO should be obtained from another MCP server that handles fleet name lookups.", schema: { fleet_imo: z.number().describe("IMO number of the fleet or group (e.g., 1000017 for SMPL DRY fleet). This should be obtained from a fleet lookup service."), start_date: z.string().optional().describe("Optional start date for filtering budget records (YYYY-MM-DD format). Filter will include budgets from this date onwards based on budget period fields"), end_date: z.string().optional().describe("Optional end date for filtering budget records (YYYY-MM-DD format). Filter will include budgets up to this date based on budget period fields"), } }, get_complete_fleet_expenses: { name: "get_complete_fleet_expenses", description: "Export ALL expense records for an entire fleet in CSV format. The tool performs the following steps: 1) Queries MongoDB common_group_details collection using the provided fleet IMO to get the list of vessel IMO numbers in the fleet, 2) Uses Typesense export to retrieve all expense data, actual costs, and financial transactions for all vessels in the fleet, 3) Converts the data to CSV format for analysis. This tool is ideal for comprehensive fleet-wide expense analysis, cost reporting, and bulk data export. The fleet IMO should be obtained from another MCP server that handles fleet name lookups.", schema: { fleet_imo: z.number().describe("IMO number of the fleet or group (e.g., 1000017 for SMPL DRY fleet). This should be obtained from a fleet lookup service."), start_date: z.string().optional().describe("Optional start date for filtering expense records (YYYY-MM-DD format). Filter will include expenses from this date onwards based on expenseDate field"), end_date: z.string().optional().describe("Optional end date for filtering expense records (YYYY-MM-DD format). Filter will include expenses up to this date based on expenseDate field"), } }, fleet_procurement_and_budget_information: { name: "fleet_procurement_and_budget_information", description: `Retrieves comprehensive fleet management information from MongoDB curated data including fleet purchase logs, purchase activities, and budget overviews for all vessels in the fleet. ### When to Use This Tool: - When users ask about fleet-wide purchase management and tracking - For fleet purchase activity analysis and monitoring - When checking fleet budget allocation and financial overviews - For fleet-wide procurement reporting and analysis - When generating fleet management reports for procurement teams - For tracking fleet purchasing patterns and budget performance - When analyzing fleet-wide financial and operational metrics ### Data Freshness: - Data reflects latest information from ERP systems - Current fleet purchase activity logs and transaction records - Updated fleet budget allocation and financial status ### Available Information by Question Number: - Q11: Fleet Budget Overviews (Comprehensive fleet budget allocation and status overview for all vessels) - Q121: Fleet Purchase Activities (Current and historical purchase activities across the entire fleet) - Q257: Fleet Purchase Log Table (Comprehensive purchase transaction logs and history for all vessels in the fleet) ### Usage Examples: - \`question_no=257\` → Fleet purchase logging overview - \`question_no=121\` → All fleet purchase activity information - \`question_no=11\` → Fleet Budget Overviews ### Output Includes: - Fleet-wide purchase order status with detailed transaction logs - Fleet purchase activity summaries with vendor information across all vessels - Fleet budget allocation summaries with performance metrics - Fleet-wide financial performance indicators and KPI tracking - Comprehensive fleet management reports and analytics - Detailed tables with filtering and sorting capabilities for fleet data`, schema: { imo: z.string().describe("Fleet IMO number or identifier for fleet-wide data retrieval"), question_no: z.union([z.literal(11), z.literal(121), z.literal(257)]).describe("Question number for specific fleet management information"), } }, get_vessel_purchase_order_information: { name: "get_vessel_purchase_order_information", description: `Retrieves comprehensive vessel purchase order information from MongoDB curated data including purchase orders with forwarders and overdue purchase order tracking. ### When to Use This Tool: - When users ask about vessel purchase order status and forwarder management - For tracking purchase orders ready for vessel connection - When checking overdue purchase orders requiring attention - For forwarder logistics and shipping coordination - When generating purchase order status reports for procurement teams - For monitoring purchase order lifecycle and vendor management - When analyzing purchase order aging and compliance tracking ### Data Freshness: - Data reflects latest information from ERP systems - Real-time purchase order status from ShipPalm system - Current forwarder information and shipping details - Updated purchase order aging and compliance status ### Available Information by Question Number: - Q122: Purchase Orders with Forwarders (List of purchase orders/spares/items available with forwarders and ready for connection onboard the vessel) - Q123: Purchase Orders Open More Than 180 Days (Purchase orders that have been open for more than 180 days requiring attention) ### Usage Examples: - \`question_no=122\` → Purchase Orders with Forwarders - \`question_no=123\` → Purchase Orders Open More Than 180 Days ### Output Includes: - Purchase order status with forwarder details and shipping information - Overdue purchase order alerts with aging analysis - Forwarder logistics coordination and vessel connection readiness - Purchase order compliance tracking and vendor management - Detailed purchase order tables with filtering and sorting capabilities - Action items for overdue orders and forwarder coordination`, schema: { imo: z.string().describe("Vessel IMO number (7-digit unique identifier)"), question_no: z.union([z.literal(122), z.literal(123)]).describe("Question number for specific purchase order information"), } }, get_vessel_budget_expense_information: { name: "get_vessel_budget_expense_information", description: `Retrieves comprehensive vessel budget and expense information from MongoDB curated data including monthly OPEX variance analysis, year-to-date budget summaries, committed costs, and manager's statements for current and previous years. ### When to Use This Tool: - When users ask about vessel budget performance and expense analysis - For monthly OPEX budget variance tracking and cost control - When checking year-to-date budget status and financial summaries - For committed cost analysis and financial obligation tracking - When reviewing manager's statements and budget reports - For current and previous year budget comparison and analysis - When generating financial reports for management and stakeholders ### Data Freshness: - Data reflects latest information from ERP systems - Real-time budget status from ShipPalm system - Current monthly variance calculations and financial metrics - Updated year-to-date performance tracking and historical comparisons ### Available Information by Question Number: - Q9: Monthly OPEX Budget Variance Analysis (Monthly operational expenditure variance analysis highlighting overspending categories and top cost contributors) - Q12: Current Year Committed Cost (Details of committed costs showing overall value and percentage against YTD OPEX budget, breakdown of carryovers and new bookings) - Q13: Current Year OPEX Budget and Expenditure (Current year operational expenditure budget vs actual spending analysis) - Q14: Manager's Statement Current Year (Current year manager's statement and budget performance summary) - Q15: Manager's Statement Previous Year (Previous year manager's statement for comparison and trend analysis) - Q16: Previous Year OPEX Budget and Expenditure (Previous year budget and expenditure for historical comparison and trend analysis) - Q17: Budget Status Summary YTD (Year-to-date OPEX variance in dollar and percentage terms, daily OPEX against budget, fund status including deficits) ### Usage Examples: - \`question_no=9\` → Monthly OPEX Budget Variance Analysis - \`question_no=17\` → All year-to-date budget information - \`question_no=12\` → Current Year Committed Cost - \`question_no=14\` → Current year manager's statements - \`question_no=15\` → Previous year manager's statements - \`question_no=13\` → Current year budget and expenditure analysis - \`question_no=16\` → Previous year budget and expenditure analysis ### Output Includes: - Monthly OPEX variance reports with detailed breakdowns and top cost contributors - Year-to-date budget status with variance analysis and fund status - Committed cost tracking with carryover and new booking breakdowns - Manager's statements for current and previous year comparison - Budget vs expenditure analysis with historical trends - Financial performance indicators and cost control recommendations - Detailed financial tables with filtering and sorting capabilities`, schema: { imo: z.string().describe("Vessel IMO number (7-digit unique identifier)"), question_no: z.union([z.literal(9), z.literal(12), z.literal(13), z.literal(14), z.literal(15), z.literal(16), z.literal(17)]).describe("Question number for specific budget and expense information"), } }, };