Skip to main content
Glama

LLM Researcher

by Code-Hex
types.ts5.51 kB
export interface SearchResult { title: string; url: string; snippet: string; index: number; } export interface SearchResultsPage { results: SearchResult[]; currentPage: number; totalPages: number; totalResults: number; hasNextPage: boolean; hasPreviousPage: boolean; query: string; nextPageParams?: Record<string, string>; previousPageParams?: Record<string, string>; } export interface SearchStatistics { totalResults: number; currentPage: number; totalPages: number; resultsPerPage: number; hasNextPage: boolean; hasPreviousPage: boolean; } export interface SearchOptions { locale?: string; } export interface Searcher { /** * Search for results with pagination support * @param query The search query * @param nextToken Optional next page token for pagination * @param options Optional search options * @returns Promise resolving to search results page */ search(query: string, nextToken?: string, options?: SearchOptions): Promise<SearchResultsPage>; /** * Get the next page of results * @param currentPage Current search results page * @returns Promise resolving to next page results */ getNextPage(currentPage: SearchResultsPage): Promise<SearchResultsPage>; /** * Get the previous page of results * @param currentPage Current search results page * @returns Promise resolving to previous page results */ getPreviousPage(currentPage: SearchResultsPage): Promise<SearchResultsPage>; /** * Get search statistics for the current query * @param query The search query * @param page Current page number * @returns Promise resolving to search statistics */ getSearchStatistics(query: string, page: number): Promise<SearchStatistics>; /** * Check if a next page is available * @param currentPage Current search results page * @returns boolean indicating if next page exists */ hasNextPage(currentPage: SearchResultsPage): boolean; /** * Check if a previous page is available * @param currentPage Current search results page * @returns boolean indicating if previous page exists */ hasPreviousPage(currentPage: SearchResultsPage): boolean; } export interface ExtractedContent { title: string; url: string; content: string; extractedAt: string; } export interface Config { verbose: boolean; userAgent: string; timeout: number; maxRetries: number; rateLimitDelay: number; cacheEnabled: boolean; maxResults: number; log: (...args: any[]) => void; } export interface RCConfig { userAgent?: string; timeout?: number; maxRetries?: number; rateLimitDelay?: number; cacheEnabled?: boolean; maxResults?: number; } export interface CLIOptions { url?: string; verbose?: boolean; github?: boolean; language?: string; extension?: string; repo?: string; user?: string; org?: string; filename?: string; path?: string; sort?: 'indexed' | 'created' | 'updated'; order?: 'asc' | 'desc'; mcp?: boolean; } export interface ContentMatch { lineNumber: number; content: string; } export type Platform = 'darwin' | 'win32' | 'linux'; // Exception classes for DuckDuckGo search export class RatelimitException extends Error { constructor( public statusCode: number, message: string = `Rate limit exceeded (HTTP ${statusCode})` ) { super(message); this.name = 'RatelimitException'; } } export class DuckDuckGoSearchException extends Error { constructor( public statusCode: number, message: string = `DuckDuckGo search failed (HTTP ${statusCode})` ) { super(message); this.name = 'DuckDuckGoSearchException'; } } // GitHub Code Search types export interface GitHubCodeSearchOptions { sort?: 'indexed' | 'created' | 'updated'; order?: 'asc' | 'desc'; perPage?: number; } export interface GitHubCodeResult { name: string; path: string; sha: string; url: string; git_url: string; html_url: string; score: number; repository: { id: number; node_id: string; name: string; full_name: string; owner: { login: string; id: number; avatar_url: string; html_url: string; }; private: boolean; html_url: string; description: string | null; language: string | null; stargazers_count: number; watchers_count: number; forks_count: number; }; text_matches?: { object_url: string; object_type: string; property: string; fragment: string; matches: { indices: [number, number]; text: string; }[]; }[]; } export interface GitHubCodeSearchResponse { total_count: number; incomplete_results: boolean; items: GitHubCodeResult[]; } // Code search query building export interface CodeSearchQuery { keywords: string[]; language?: string; extension?: string; filename?: string; path?: string; repo?: string; user?: string; org?: string; size?: string; in?: ('file' | 'path')[]; } export interface ParsedCodeSearchInput { query: CodeSearchQuery; remainingKeywords: string[]; } export class GitHubSearchException extends Error { constructor( public statusCode: number, message: string = `GitHub search failed (HTTP ${statusCode})` ) { super(message); this.name = 'GitHubSearchException'; } } export class GitHubAuthException extends Error { constructor(message: string = 'GitHub authentication required (gh auth login)') { super(message); this.name = 'GitHubAuthException'; } }

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/Code-Hex/light-research-mcp'

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