Export Solution
export-solutionExport Power Platform solutions as base64-encoded packages to serialize configurations for backup, migration, and deployment across environments.
Instructions
Export a solution as a base64-encoded package. This is a read-only operation that serializes the solution.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| solutionName | Yes | The unique name of the solution to export | |
| managed | No | Export as managed solution (default: false) | |
| environment | No | Environment name (e.g. DEV, UAT). Uses default if omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| solutionName | Yes | ||
| exportResult | Yes |
Implementation Reference
- src/services/solution-service.ts:60-89 (handler)Main handler implementation - SolutionService.exportSolution() method that performs the actual export operation via PowerPlatform API. Sends POST request to api/data/v9.2/ExportSolution with solution name and export options.
/** * Export a solution as a base64-encoded package. * This is a read-only operation that serializes the solution for download. * * @param solutionName - The unique name of the solution to export * @param managed - Whether to export as a managed solution (default: false) */ async exportSolution( solutionName: string, managed: boolean = false ): Promise<unknown> { return this.client.post( 'api/data/v9.2/ExportSolution', { SolutionName: solutionName, Managed: managed, ExportAutoNumberingSettings: true, ExportCalendarSettings: true, ExportCustomizationSettings: true, ExportEmailTrackingSettings: true, ExportGeneralSettings: true, ExportMarketingSettings: true, ExportOutlookSynchronizationSettings: true, ExportRelationshipRoles: true, ExportIsvConfig: true, ExportSales: true, ExportExternalApplications: true, } ); } - src/tools/solution-tools.ts:192-235 (registration)Tool registration - registers "export-solution" with the MCP server. Defines the tool name, description, input/output schemas, and handler wrapper function that calls service.exportSolution().
// Export Solution server.registerTool( "export-solution", { title: "Export Solution", description: "Export a solution as a base64-encoded package. This is a read-only operation that serializes the solution.", inputSchema: { solutionName: z.string().describe("The unique name of the solution to export"), managed: z.boolean().optional().describe("Export as managed solution (default: false)"), environment: z.string().optional().describe("Environment name (e.g. DEV, UAT). Uses default if omitted."), }, outputSchema: z.object({ solutionName: z.string(), exportResult: z.any(), }), }, async ({ solutionName, managed, environment }) => { try { const ctx = registry.getContext(environment); const service = ctx.getSolutionService(); const result = await service.exportSolution(solutionName, managed ?? false); return { structuredContent: { solutionName, exportResult: result }, content: [ { type: "text", text: `Solution '${solutionName}' exported successfully (managed: ${managed ?? false}):\n\n${JSON.stringify(result, null, 2)}`, }, ], }; } catch (error: any) { console.error("Error exporting solution:", error); return { content: [ { type: "text", text: `Failed to export solution: ${error.message}`, }, ], }; } } ); - src/tools/solution-tools.ts:195-206 (schema)Input/output schema definitions using Zod. Defines solutionName (string, required), managed (boolean, optional), environment (string, optional) inputs, and structured output with solutionName and exportResult.
{ title: "Export Solution", description: "Export a solution as a base64-encoded package. This is a read-only operation that serializes the solution.", inputSchema: { solutionName: z.string().describe("The unique name of the solution to export"), managed: z.boolean().optional().describe("Export as managed solution (default: false)"), environment: z.string().optional().describe("Environment name (e.g. DEV, UAT). Uses default if omitted."), }, outputSchema: z.object({ solutionName: z.string(), exportResult: z.any(), }),