Skip to main content
Glama
SearchProvider.ts1.02 kB
/** * Interface representing a single search result */ export interface SearchResult { title: string; url: string; description: string; } export interface SearchResponse { query: string; results: SearchResult[]; totalResults?: number; searchTime?: number; } export interface SearchProviderConfig { apiKey: string; maxResults: number; timeout: number; } export abstract class SearchProvider { protected config: SearchProviderConfig | null = null; initialize(config: SearchProviderConfig): void { this.config = config; } abstract getName(): string; abstract search(query: string): Promise<SearchResponse>; protected validateConfig(): void { if (!this.config) { throw new Error(`${this.getName()} provider not initialized`); } if (!this.config.apiKey) { throw new Error(`${this.getName()} API key not configured`); } } protected createEmptyResponse(query: string): SearchResponse { return { query, results: [], }; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gabrimatic/mcp-web-search-tool'

If you have feedback or need assistance with the MCP directory API, please join our Discord server