UNPKG

bc-webclient-mcp

Version:

Model Context Protocol (MCP) server for Microsoft Dynamics 365 Business Central via WebUI protocol. Enables AI assistants to interact with BC through the web client protocol, supporting Card, List, and Document pages with full line item support and server

369 lines 11.1 kB
/** * Model Context Protocol (MCP) Types * * Type definitions for MCP tools, resources, and protocol interactions. * These types define how the BC MCP server exposes capabilities to Claude. */ export interface MCPToolParameter { readonly type: string; readonly description: string; readonly required?: boolean; readonly enum?: readonly string[]; readonly items?: MCPToolParameter; readonly properties?: Record<string, MCPToolParameter>; } export interface MCPToolDefinition { readonly name: string; readonly description: string; readonly inputSchema: { readonly type: 'object'; readonly properties: Record<string, MCPToolParameter>; readonly required?: readonly string[]; }; } export interface MCPToolRequest { readonly name: string; readonly arguments: Record<string, unknown>; } export interface MCPToolResponse { readonly content: readonly MCPContent[]; readonly isError?: boolean; } export interface MCPContent { readonly type: 'text' | 'image' | 'resource'; readonly text?: string; readonly data?: string; readonly mimeType?: string; } export interface MCPResource { readonly uri: string; readonly name: string; readonly description: string; readonly mimeType: string; } export interface MCPResourceRequest { readonly uri: string; } export interface MCPResourceResponse { readonly contents: readonly MCPResourceContent[]; } export interface MCPResourceContent { readonly uri: string; readonly mimeType: string; readonly text?: string; readonly blob?: string; } export interface SearchPagesInput { readonly query: string; readonly limit?: number; readonly type?: 'Card' | 'List' | 'Document' | 'Worksheet' | 'Report'; } export interface GetPageMetadataInput { readonly pageId: string | number; readonly pageContextId?: string; } export interface ReadPageDataInput { readonly pageContextId: string; readonly filters?: Record<string, unknown>; readonly setCurrent?: boolean; readonly limit?: number; readonly offset?: number; } export interface WritePageDataInput { readonly pageContextId: string; readonly fields: Record<string, { value: unknown; controlPath?: string; }>; readonly stopOnError?: boolean; readonly immediateValidation?: boolean; } export interface ExecuteActionInput { readonly pageContextId: string; readonly action: string | { actionId?: string; captionPath?: string; }; readonly target?: { partId?: string; }; readonly recordSelector?: { systemId?: string; keys?: Record<string, unknown>; useCurrent?: boolean; }; readonly expectDialog?: boolean; readonly waitForDialogMs?: number; } export interface FilterListInput { readonly pageContextId: string; readonly columnName: string; readonly filterValue?: string; } export interface HandleDialogInput { readonly pageContextId: string; readonly selection?: { bookmark?: string; rowNumber?: number; rowFilter?: Record<string, any>; }; readonly action: string; readonly wait?: 'appear' | 'existing'; readonly timeoutMs?: number; readonly workflowId?: string; } export interface UpdateRecordInput { readonly pageId?: string; readonly pageContextId?: string; readonly recordSelector?: { systemId?: string; keys?: Record<string, unknown>; useCurrent?: boolean; }; readonly fields: Record<string, unknown>; readonly autoEdit?: boolean; readonly save?: boolean; } export interface CreateRecordInput { readonly pageId?: string; readonly pageContextId?: string; readonly fields: Record<string, unknown>; readonly autoOpen?: boolean; readonly save?: boolean; } export interface FindRecordInput { readonly pageContextId: string; readonly filter: string; readonly setCurrent?: boolean; readonly requireUnique?: boolean; } export interface SearchPagesOutput { readonly pages: readonly PageSearchResult[]; readonly totalCount: number; } export interface PageSearchResult { readonly pageId: string; readonly caption: string; readonly type: string; readonly appName?: string; } export interface GetPageMetadataOutput { readonly pageId: string; readonly pageContextId: string; readonly caption: string; readonly description: string; readonly pageType: 'Card' | 'List' | 'Document' | 'Worksheet' | 'Report'; readonly fields: readonly FieldDescription[]; readonly actions: readonly ActionDescription[]; readonly repeaters: readonly RepeaterDescription[]; } export interface RepeaterDescription { readonly name: string; readonly caption: string; readonly controlPath: string; readonly formId: string; readonly columns: readonly RepeaterColumnDescription[]; } /** * Repeater column metadata. * * Note: Columns may be progressively enriched as BC sends 'rcc' (Repeater Column Control) * messages during grid realization (e.g., when Lines/Edit actions are invoked or data is read). * Initial metadata from OpenForm/LoadForm may have empty columns array. */ export interface RepeaterColumnDescription { readonly name: string; readonly caption: string; readonly controlPath?: string; readonly columnBinder?: string; readonly editable?: boolean; readonly tableEditable?: boolean; readonly horizontalAlignment?: 'Left' | 'Right' | 'Center'; readonly controlIdentifier?: string; } export interface FieldDescription { readonly name: string; readonly caption: string; readonly type: string; readonly required: boolean; readonly editable: boolean; } export interface ActionDescription { readonly name: string; readonly caption: string; readonly enabled: boolean; readonly description?: string; } export interface DocumentLinesBlock { readonly repeaterPath: string; readonly caption: string; readonly lines: readonly PageDataRecord[]; readonly totalCount: number; } export interface ReadPageDataOutput { readonly pageId: string; readonly pageContextId: string; readonly caption: string; readonly pageType: 'Card' | 'List' | 'Document'; readonly records: readonly PageDataRecord[]; readonly totalCount: number; readonly hasMore?: boolean; readonly currentRecord?: PageDataRecord; readonly header?: PageDataRecord; readonly linesBlocks?: readonly DocumentLinesBlock[]; } export interface PageDataRecord { readonly bookmark?: string; readonly [key: string]: string | number | boolean | null | undefined; } export interface PageFieldValue { readonly value: string | number | boolean | null; readonly displayValue?: string; readonly type: 'string' | 'number' | 'boolean' | 'date'; } export interface WritePageDataOutput { readonly success: boolean; readonly pageContextId: string; readonly record?: PageDataRecord; readonly saved: boolean; readonly message?: string; readonly updatedFields?: string[]; readonly failedFields?: Array<{ field: string; error: string; validationMessage?: string; }>; } export interface ExecuteActionOutput { readonly success: boolean; readonly pageContextId: string; readonly message?: string; readonly result?: 'Closed' | 'Navigated' | 'DialogOpened' | 'ActionExecuted'; readonly navigation?: { pageContextId: string; pageId: string; caption: string; }; readonly dialog?: { dialogId: string; title: string; }; } export interface FilterListOutput { readonly success: boolean; readonly pageContextId: string; readonly pageId: string; readonly columnName: string; readonly filterValue?: string; readonly message?: string; readonly availableColumns?: readonly string[]; } export interface HandleDialogOutput { readonly success: boolean; readonly pageContextId: string; readonly sessionId: string; readonly dialogId: string; readonly result: 'Closed'; readonly action: string; readonly selectedBookmark?: string; readonly message?: string; } export interface UpdateRecordOutput { readonly success: boolean; readonly pageContextId: string; readonly pageId: string; readonly record?: PageDataRecord; readonly saved: boolean; readonly updatedFields?: readonly string[]; readonly failedFields?: ReadonlyArray<{ field: string; error: string; validationMessage?: string; }>; readonly message?: string; } export interface CreateRecordOutput { readonly success: boolean; readonly pageContextId: string; readonly pageId: string; readonly record?: PageDataRecord; readonly saved: boolean; readonly setFields?: readonly string[]; readonly failedFields?: ReadonlyArray<{ field: string; error: string; validationMessage?: string; }>; readonly message?: string; } export interface FindRecordOutput { readonly success: boolean; readonly pageContextId: string; readonly pageId: string; readonly record?: PageDataRecord; readonly records?: readonly PageDataRecord[]; readonly totalMatches?: number; readonly message?: string; } export interface MCPServerConfig { readonly name: string; readonly version: string; readonly capabilities: { readonly tools: boolean; readonly resources: boolean; readonly prompts?: boolean; }; } export interface MCPServerInfo { readonly name: string; readonly version: string; } export interface MCPInitializeRequest { readonly protocolVersion: string; readonly clientInfo: { readonly name: string; readonly version: string; }; readonly capabilities: { readonly tools?: boolean; readonly resources?: boolean; }; } export interface MCPInitializeResponse { readonly protocolVersion: string; readonly serverInfo: MCPServerInfo; readonly capabilities: MCPServerConfig['capabilities']; } export interface MCPToolsListRequest { readonly method: 'tools/list'; } export interface MCPToolsListResponse { readonly tools: readonly MCPToolDefinition[]; } export interface MCPToolCallRequest { readonly method: 'tools/call'; readonly params: { readonly name: string; readonly arguments: Record<string, unknown>; }; } export interface MCPToolCallResponse { readonly content: readonly MCPContent[]; readonly isError?: boolean; } export interface MCPResourcesListRequest { readonly method: 'resources/list'; } export interface MCPResourcesListResponse { readonly resources: readonly MCPResource[]; } export interface MCPResourcesReadRequest { readonly method: 'resources/read'; readonly params: { readonly uri: string; }; } export interface MCPResourcesReadResponse { readonly contents: readonly MCPResourceContent[]; } //# sourceMappingURL=mcp-types.d.ts.map