Skip to main content
Glama
types.ts•2.67 kB
export type OpenAiGlobals< ToolInput = UnknownObject, ToolOutput = UnknownObject, ToolResponseMetadata = UnknownObject, WidgetState = UnknownObject > = { // visuals theme: Theme; userAgent: UserAgent; locale: string; // layout maxHeight: number; displayMode: DisplayMode; safeArea: SafeArea; // state toolInput: ToolInput; toolOutput: ToolOutput | null; toolResponseMetadata: ToolResponseMetadata | null; widgetState: WidgetState | null; setWidgetState: (state: WidgetState) => Promise<void>; }; // API interface for window.openai type API = { callTool: CallTool; sendFollowUpMessage: (args: { prompt: string }) => Promise<void>; openExternal(payload: { href: string }): void; requestDisplayMode: RequestDisplayMode; }; export type UnknownObject = Record<string, unknown>; export type Theme = "light" | "dark"; export type SafeAreaInsets = { top: number; bottom: number; left: number; right: number; }; export type SafeArea = { insets: SafeAreaInsets; }; export type DeviceType = "mobile" | "tablet" | "desktop" | "unknown"; export type UserAgent = { device: { type: DeviceType }; capabilities: { hover: boolean; touch: boolean; }; }; export type DisplayMode = "pip" | "inline" | "fullscreen"; export type RequestDisplayMode = (args: { mode: DisplayMode }) => Promise<{ mode: DisplayMode; }>; export type CallToolResponse = { result: string; }; export type CallTool = ( name: string, args: Record<string, unknown> ) => Promise<CallToolResponse>; // Events export const SET_GLOBALS_EVENT_TYPE = "openai:set_globals"; export class SetGlobalsEvent extends CustomEvent<{ globals: Partial<OpenAiGlobals>; }> { readonly type = SET_GLOBALS_EVENT_TYPE; } // Global window declaration declare global { interface Window { openai: API & OpenAiGlobals; } interface WindowEventMap { [SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent; } } // Chess-specific types export interface ChessToolOutput { fen: string; move?: string; status: string; turn: string; puzzle_type?: string; difficulty?: string; } export interface ChessMetadata { full_state?: { success: boolean; move: string; fen: string; turn: string; move_history: string; status: string; legal_moves_count: number; is_check: boolean; is_checkmate: boolean; is_stalemate: boolean; }; legal_moves?: string[]; move_history_list?: string[]; solution?: string; hint?: string; is_puzzle?: boolean; } export interface ChessWidgetState { lastDepth?: number; puzzleDifficulty?: string; analysisVisible?: boolean; boardOrientation?: "white" | "black"; }

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/GeneralJerel/ChessMCP'

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