@mseep/doit-mcp-server
Version:
DoiT official MCP Server
58 lines (57 loc) • 2 kB
TypeScript
export declare const DOIT_API_BASE = "https://api.doit.com";
/**
* Creates a standardized error response
* @param message Error message to display to the user
* @returns Formatted error response object
*/
export declare function createErrorResponse(message: string): {
content: {
type: string;
text: string;
}[];
};
/**
* Creates a standardized success response
* @param text Content text to display to the user
* @returns Formatted success response object
*/
export declare function createSuccessResponse(text: string): {
content: {
type: string;
text: string;
}[];
};
/**
* Formats an error message from a ZodError
* @param error The ZodError object
* @returns Formatted error message string
*/
export declare function formatZodError(error: any): string;
/**
* Helper function to handle general errors
* @param error The error object
* @param context Additional context to include in the log message
* @returns Standardized error response
*/
export declare function handleGeneralError(error: any, context: string): ReturnType<typeof createErrorResponse>;
/**
* Helper function to append customer context to URL if available
* @param baseUrl The base URL to append parameters to
* @returns URL with maxResults and optional customerContext parameters
*/
export declare function appendUrlParameters(baseUrl: string): string;
/**
* Helper function for making DoiT API requests
* @param url The API endpoint URL
* @param token The authentication token
* @param options Additional request options
* @param options.method HTTP method (GET, POST, etc.)
* @param options.body Request body for POST/PUT requests
* @param options.appendParams Whether to append URL parameters (maxResults and customerContext)
* @returns The parsed JSON response or null on error
*/
export declare function makeDoitRequest<T>(url: string, token: string, options?: {
method?: string;
body?: any;
appendParams?: boolean;
}): Promise<T | null>;