create_dataverse_solution
Create a new unmanaged solution container in Dataverse to package, deploy, and manage custom components like tables, columns, and other customizations.
Instructions
Creates a new unmanaged solution in Dataverse. Solutions are containers for customizations and allow you to package, deploy, and manage custom components. Use this to create a solution before adding tables, columns, and other customizations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Description of the solution | |
| friendlyName | Yes | Friendly name for the solution | |
| publisherUniqueName | Yes | Unique name of the publisher to associate with this solution | |
| uniqueName | Yes | Unique name for the solution (e.g., 'examplesolution') | |
| version | No | Version of the solution | 1.0.0.0 |
Implementation Reference
- src/tools/solution-tools.ts:89-129 (handler)The core handler function implementing the tool logic: retrieves publisher by unique name, binds publisher ID to solution definition, creates unmanaged solution via Dataverse API POST /solutions, handles errors, and returns success/error markdown content.async (params) => { try { // First, get the publisher to get its ID const publisherResponse = await client.get(`publishers?$filter=uniquename eq '${params.publisherUniqueName}'&$select=publisherid`); if (!publisherResponse.value || publisherResponse.value.length === 0) { throw new Error(`Publisher with unique name '${params.publisherUniqueName}' not found`); } const publisherId = publisherResponse.value[0].publisherid; const solutionDefinition = { friendlyname: params.friendlyName, uniquename: params.uniqueName, description: params.description || `Solution for ${params.friendlyName}`, version: params.version, "publisherid@odata.bind": `/publishers(${publisherId})` }; const result = await client.post('solutions', solutionDefinition); return { content: [ { type: "text", text: `Successfully created solution '${params.friendlyName}' (${params.uniqueName}) linked to publisher '${params.publisherUniqueName}'.\n\nResponse: ${JSON.stringify(result, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating solution: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
- src/tools/solution-tools.ts:78-88 (schema)Input/output schema definition for the tool, using Zod validators for required parameters (friendlyName, uniqueName, publisherUniqueName) and optional fields, with descriptive annotations.{ title: "Create Dataverse Solution", description: "Creates a new unmanaged solution in Dataverse. Solutions are containers for customizations and allow you to package, deploy, and manage custom components. Use this to create a solution before adding tables, columns, and other customizations.", inputSchema: { friendlyName: z.string().describe("Friendly name for the solution"), uniqueName: z.string().describe("Unique name for the solution (e.g., 'examplesolution')"), description: z.string().optional().describe("Description of the solution"), version: z.string().default("1.0.0.0").describe("Version of the solution"), publisherUniqueName: z.string().describe("Unique name of the publisher to associate with this solution") } },
- src/tools/solution-tools.ts:75-131 (registration)The registration helper function that calls server.registerTool with the tool name 'create_dataverse_solution', schema, and handler. This modular function is imported and invoked from src/index.ts.export function createSolutionTool(server: McpServer, client: DataverseClient) { server.registerTool( "create_dataverse_solution", { title: "Create Dataverse Solution", description: "Creates a new unmanaged solution in Dataverse. Solutions are containers for customizations and allow you to package, deploy, and manage custom components. Use this to create a solution before adding tables, columns, and other customizations.", inputSchema: { friendlyName: z.string().describe("Friendly name for the solution"), uniqueName: z.string().describe("Unique name for the solution (e.g., 'examplesolution')"), description: z.string().optional().describe("Description of the solution"), version: z.string().default("1.0.0.0").describe("Version of the solution"), publisherUniqueName: z.string().describe("Unique name of the publisher to associate with this solution") } }, async (params) => { try { // First, get the publisher to get its ID const publisherResponse = await client.get(`publishers?$filter=uniquename eq '${params.publisherUniqueName}'&$select=publisherid`); if (!publisherResponse.value || publisherResponse.value.length === 0) { throw new Error(`Publisher with unique name '${params.publisherUniqueName}' not found`); } const publisherId = publisherResponse.value[0].publisherid; const solutionDefinition = { friendlyname: params.friendlyName, uniquename: params.uniqueName, description: params.description || `Solution for ${params.friendlyName}`, version: params.version, "publisherid@odata.bind": `/publishers(${publisherId})` }; const result = await client.post('solutions', solutionDefinition); return { content: [ { type: "text", text: `Successfully created solution '${params.friendlyName}' (${params.uniqueName}) linked to publisher '${params.publisherUniqueName}'.\n\nResponse: ${JSON.stringify(result, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating solution: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); }
- src/index.ts:168-168 (registration)Top-level invocation of the tool registration helper in the main MCP server initialization script, passing the server instance and Dataverse client.createSolutionTool(server, dataverseClient);