@rhofkens/mcp-quotes-server
Version:
A Model Context Protocol (MCP) server that provides quotes based on user requests
38 lines (37 loc) • 1.34 kB
TypeScript
interface BaseValidationResult {
readonly success: boolean;
}
export interface ValidationSuccess extends BaseValidationResult {
readonly success: true;
readonly data: QuoteRequestParameters;
}
export interface ValidationError extends BaseValidationResult {
readonly success: false;
readonly errors: readonly string[];
readonly field?: string;
}
export type ValidationResult = ValidationSuccess | ValidationError;
export interface QuoteRequestParameters {
readonly person: string;
readonly topic?: string;
readonly numberOfQuotes: number;
}
export interface RawQuoteRequestParameters {
readonly person: unknown;
readonly topic?: unknown;
readonly numberOfQuotes: unknown;
}
export interface PersonValidationError extends ValidationError {
readonly field: "person";
readonly errorType: "empty" | "whitespace_only" | "invalid_type";
}
export interface TopicValidationError extends ValidationError {
readonly field: "topic";
readonly errorType: "invalid_type";
}
export interface NumberOfQuotesValidationError extends ValidationError {
readonly field: "numberOfQuotes";
readonly errorType: "invalid_type" | "out_of_range" | "not_integer";
}
export type SpecificValidationError = PersonValidationError | TopicValidationError | NumberOfQuotesValidationError;
export {};