/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module ai/aicore/model/aicontext * @publicApi */ /** * The type of context item. * * Available types: * * `'mcp-tool-context'`: a tool-related context item, * * `'file'`: a file (PDF, Word document, etc.), * * `'document'`: a current editor document * (used by {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig#document `config.ai.chat.context.document` option}), * * `'web-resource'`: a URL (web page, blog post, etc.), * * `'text'`: a text (plain text, Markdown, HTML, etc.), * * `'selection'`: a selection of text in the editor * (used by {@link module:ai/aiquickactions/aiquickactions~AIQuickActions AI Quick Actions} that pass the user selection * to the {@link module:ai/aichat/aichat~AIChat AI Chat}). */ export type AIContextItemType = 'mcp-tool-context' | 'file' | 'document' | 'web-resource' | 'text' | 'selection'; /** * The type of text resource. */ export type AIContextTextResourceType = 'text' | 'markdown' | 'html'; /** * A context item. */ export type AIContextItem = AIContextItemRequestData & { label: string; uiId: string; resourceId?: string; isReadOnly?: boolean; version?: number; hidden?: boolean; sessionId?: string | null; selection?: Array<{ start: number; end: number; }>; }; /** * A tool-related context item. */ export type AIToolContextItem = AIContextItem & { type: 'mcp-tool-context'; mcpServerName: string; toolName?: string; data: Record; /** * ID length can be between 1 and 21 characters. If not provided, it will be randomly generated 21 characters long string. */ id?: string; }; /** * A context item request data for using in the `AIConnector`. */ export type AIContextItemRequestData = { type: AIContextItemType; content?: string; id?: string; selection?: Array<{ start: number; end: number; }>; }; export type AIToolRequestData = { type: 'mcp-tool-context'; mcpServerName: string; toolName?: string; data: Record; };