@guilhermebarroso-sys/onyx-mcp
Version:
Model Context Protocol (MCP) server for seamless integration with Onyx AI knowledge bases
69 lines (68 loc) • 2.35 kB
TypeScript
import { OnyxConfig, OnyxSearchResult } from '../types/index.js';
/**
* Document interface for chat responses
*/
interface OnyxDocument {
document_id: string;
semantic_identifier: string;
score?: number;
link?: string;
}
/**
* OnyxApiService class for interacting with the Onyx API
*/
export declare class OnyxApiService {
private config;
/**
* Constructor
* @param config The Onyx configuration
*/
constructor(config: OnyxConfig);
/**
* Search Onyx for relevant documents
* @param query The search query
* @param documentSets Optional document sets to search within
* @param chunksAbove Number of chunks to include above the matching chunk
* @param chunksBelow Number of chunks to include below the matching chunk
* @returns Array of search results
*/
searchOnyx(query: string, documentSets?: string[], chunksAbove?: number, chunksBelow?: number): Promise<OnyxSearchResult[]>;
/**
* Fetch a specific chunk from a document
* @param documentId The document ID
* @param chunkId The chunk ID
* @returns The chunk content
*/
fetchDocumentChunk(documentId: string, chunkId: number): Promise<string>;
/**
* Fetch the full content of a document by retrieving all its chunks
* @param documentId The document ID
* @returns The full document content
*/
fetchDocumentContent(documentId: string): Promise<string>;
/**
* Create a new chat session
* @param personaId The persona ID to use
* @returns The chat session ID
*/
createChatSession(personaId: number): Promise<string>;
/**
* Send a message to a chat session
* @param sessionId The chat session ID
* @param query The message to send
* @param documentSets Optional document sets to search within
* @returns The chat response
*/
sendChatMessage(sessionId: string, query: string, documentSets?: string[]): Promise<{
answer: string;
documents: OnyxDocument[];
}>;
/**
* Build a comprehensive context from search results and content
* @param results The search results
* @param contents The content for each result
* @returns Formatted context string
*/
buildContext(results: OnyxSearchResult[], contents: string[]): string;
}
export {};