defect-inspection-tools-mcp-server
Version:
Defect inspection tools server handling defect detection, analysis, and reporting with AI/ML capabilities for quality control
135 lines (134 loc) • 4.16 kB
TypeScript
import { ExternalApiService } from '../services/external-api-service.js';
export interface TypesenseSearchParams {
q: string;
query_by?: string;
filter_by?: string;
sort_by?: string;
facet_by?: string;
max_facet_values?: number;
page?: number;
per_page?: number;
group_by?: string;
group_limit?: number;
include_fields?: string;
exclude_fields?: string;
highlight_fields?: string;
highlight_affix_num_tokens?: number;
snippet_threshold?: number;
num_typos?: string;
prefix?: boolean;
drop_tokens_threshold?: number;
typo_tokens_threshold?: number;
pinned_hits?: string;
hidden_hits?: string;
enable_overrides?: boolean;
pre_segmented_query?: boolean;
vector_query?: string;
}
export interface TypesenseSearchResult {
found: number;
out_of: number;
page: number;
request_params: TypesenseSearchParams;
search_time_ms: number;
hits: TypesenseHit[];
facet_counts?: TypesenseFacetCount[];
grouped_hits?: TypesenseGroupedHit[];
}
export interface TypesenseHit {
document: any;
highlight?: Record<string, any>;
highlights?: TypesenseHighlight[];
text_match?: number;
geo_distance_meters?: number;
}
export interface TypesenseHighlight {
field: string;
snippet: string;
value: string;
matched_tokens: string[];
indices: number[];
}
export interface TypesenseFacetCount {
field_name: string;
counts: TypesenseFacetValue[];
stats?: TypesenseFacetStats;
}
export interface TypesenseFacetValue {
count: number;
highlighted: string;
value: string;
}
export interface TypesenseFacetStats {
avg?: number;
max?: number;
min?: number;
sum?: number;
}
export interface TypesenseGroupedHit {
group_key: string[];
hits: TypesenseHit[];
}
export interface TypesenseCollection {
name: string;
num_documents: number;
fields: TypesenseField[];
default_sorting_field: string;
created_at: number;
}
export interface TypesenseField {
name: string;
type: string;
facet?: boolean;
optional?: boolean;
index?: boolean;
sort?: boolean;
infix?: boolean;
locale?: string;
stem?: boolean;
}
export interface TypesenseDocumentUpsert {
id?: string;
action?: 'create' | 'update' | 'upsert';
[key: string]: any;
}
export declare class TypesenseService {
private static readonly DEFAULT_SEARCH_PARAMS;
private static readonly MARITIME_COLLECTIONS;
private typesenseService;
constructor(typesenseService: ExternalApiService);
searchMaritimeData(query: string, collections?: string[], params?: Partial<TypesenseSearchParams>): Promise<TypesenseSearchResult>;
searchCollection(collection: string, params: TypesenseSearchParams): Promise<TypesenseSearchResult>;
searchDefects(query: string, filters?: {
vessel_name?: string;
imo_number?: number;
defect_type?: string;
severity?: string;
status?: string;
inspection_date_range?: string;
stage?: string;
}, params?: Partial<TypesenseSearchParams>): Promise<TypesenseSearchResult>;
searchVessels(query: string, filters?: {
imo_number?: number;
vessel_type?: string;
flag_state?: string;
class_society?: string;
built_year_range?: string;
deadweight_range?: string;
}, params?: Partial<TypesenseSearchParams>): Promise<TypesenseSearchResult>;
searchInspections(query: string, filters?: {
vessel_name?: string;
imo_number?: number;
inspection_type?: string;
inspector?: string;
port?: string;
date_range?: string;
status?: string;
}, params?: Partial<TypesenseSearchParams>): Promise<TypesenseSearchResult>;
getCollectionInfo(collection: string): Promise<TypesenseCollection>;
listCollections(): Promise<TypesenseCollection[]>;
upsertDocument(collection: string, document: TypesenseDocumentUpsert): Promise<any>;
deleteDocument(collection: string, documentId: string): Promise<any>;
private sanitizeSearchParams;
private combineSearchResults;
}