Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

set_solution_context

Define the solution context for Dataverse metadata operations to automatically associate new tables, columns, and relationships with the specified solution.

Instructions

Sets the active solution context for all subsequent metadata operations. When a solution context is set, all created tables, columns, relationships, and other components will be automatically added to this solution. This is required before creating any custom components.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
solutionUniqueNameYesUnique name of the solution to set as context for subsequent operations

Implementation Reference

  • The core handler function for the 'set_solution_context' tool. It calls the DataverseClient to set the solution context, verifies it, and returns a success message with context details or an error response.
    async (params) => { try { await client.setSolutionContext(params.solutionUniqueName); const context = client.getSolutionContext(); if (!context) { throw new Error('Failed to set solution context'); } return { content: [ { type: "text", text: `Solution context set to '${context.solutionUniqueName}' (${context.solutionDisplayName}). All subsequent metadata operations will be associated with this solution.\n\nPublisher: ${context.publisherDisplayName} (${context.publisherUniqueName})\nPrefix: ${context.customizationPrefix}\n\nContext has been persisted to .dataverse-mcp file.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting solution context: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } );
  • The tool schema definition including title, description, and Zod input schema for the solutionUniqueName parameter.
    "set_solution_context", { title: "Set Solution Context", description: "Sets the active solution context for all subsequent metadata operations. When a solution context is set, all created tables, columns, relationships, and other components will be automatically added to this solution. This is required before creating any custom components.", inputSchema: { solutionUniqueName: z.string().describe("Unique name of the solution to set as context for subsequent operations") } },
  • src/index.ts:175-175 (registration)
    Invocation of the setSolutionContextTool registration function during server initialization, which registers the tool with the MCP server.
    setSolutionContextTool(server, dataverseClient);
  • Supporting helper method on DataverseClient that fetches solution and publisher details from the API, sets the internal context state, and persists it to .dataverse-mcp file. Called by the tool handler.
    async setSolutionContext(solutionUniqueName: string): Promise<void> { try { // Fetch solution details to populate context const result = await this.get( `solutions?$filter=uniquename eq '${solutionUniqueName}'&$expand=publisherid($select=uniquename,friendlyname,customizationprefix)&$select=uniquename,friendlyname` ); if (!result.value || result.value.length === 0) { throw new Error(`Solution '${solutionUniqueName}' not found`); } const solution = result.value[0]; const publisher = solution.publisherid; this.solutionContext = { solutionUniqueName: solution.uniquename, solutionDisplayName: solution.friendlyname, publisherUniqueName: publisher?.uniquename, publisherDisplayName: publisher?.friendlyname, customizationPrefix: publisher?.customizationprefix, lastUpdated: new Date().toISOString() }; this.solutionUniqueName = solutionUniqueName; this.saveSolutionContext(); } catch (error) { throw new Error(`Failed to set solution context: ${error instanceof Error ? error.message : 'Unknown error'}`); } }

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mwhesse/mcp-dataverse'

If you have feedback or need assistance with the MCP directory API, please join our Discord server