Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Set Solution Context

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'}`);
      }
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that this tool affects 'all subsequent metadata operations' and that components 'will be automatically added to this solution', which are important behavioral traits. However, it doesn't mention potential side effects, error conditions, or authentication requirements, leaving some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with two sentences that are front-loaded and zero waste. The first sentence explains the core functionality, and the second provides critical usage guidance, with every sentence earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (setting a context for metadata operations) and the absence of annotations and output schema, the description is mostly complete. It explains the purpose, usage, and effect, but lacks details on error handling or what happens if the context is invalid, which could be helpful for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the single parameter 'solutionUniqueName' with a clear description. The description doesn't add any additional meaning or context about the parameter beyond what the schema provides, making the baseline score of 3 appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Sets the active solution context') and resource ('for all subsequent metadata operations'), distinguishing it from sibling tools like 'clear_solution_context' and 'get_solution_context'. It explicitly explains the scope and effect of setting this context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'This is required before creating any custom components.' It also distinguishes it from alternatives by explaining its role in the workflow for metadata operations, though it doesn't name specific sibling alternatives beyond the clear context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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