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
69 lines • 2.11 kB
TypeScript
/**
* Action Service
*
* Handles Business Central action execution, including standard actions
* (New, Delete, Post) and custom page actions.
*
* This service layer abstracts the business logic from the MCP tool adapters.
*/
import type { Result } from '../core/result.js';
import type { BCError } from '../core/errors.js';
export interface ActionResult {
success: boolean;
actionName: string;
pageContextId: string;
message?: string;
result?: unknown;
validationErrors?: Array<{
field?: string;
message: string;
}>;
}
export interface DialogField {
name: string;
value: unknown;
type?: string;
}
export interface DialogAction {
name: string;
caption: string;
enabled: boolean;
}
/**
* Service for executing Business Central actions
*/
export declare class ActionService {
private readonly handlerParser;
constructor();
/**
* Execute an action on a Business Central page
*/
executeAction(pageContextId: string, actionName: string, parameters?: Record<string, unknown>): Promise<Result<ActionResult, BCError>>;
/** Validate pageContextId and get connection */
private validateAndGetConnection;
/** Map action name to BC interaction name */
private mapActionToInteraction;
/** Build named parameters from input */
private buildNamedParameters;
/** Build error result for failed action */
private buildActionErrorResult;
/** Build success result, checking for triggered dialogs */
private buildActionSuccessResult;
/**
* Handle dialog interactions
*/
handleDialog(pageContextId: string, fields?: DialogField[], action?: string): Promise<Result<ActionResult, BCError>>;
/** Handler structure for dialog check */
private static isDialogHandler;
/**
* Check if handlers contain a dialog
*/
private checkForDialog;
/** Error context structure */
private static hasContext;
/**
* Extract validation errors from error context
*/
private extractValidationErrors;
}
//# sourceMappingURL=action-service.d.ts.map