Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Get Dataverse Option Set Options

get_dataverse_optionset_options

Retrieve all available choices, values, labels, descriptions, and colors from a specific option set in Microsoft Dataverse to understand available selections and their configuration.

Instructions

Retrieves all options (choices) within a specific option set, including their values, labels, descriptions, and colors. Use this to inspect the available choices in an option set and understand their configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the option set to get options for

Implementation Reference

  • The main handler function for the tool. It retrieves the option set metadata from Dataverse using the client, maps the Options array to a simplified format (value, label, description, color, isManaged), and returns the options as formatted JSON text or an error message.
    async (params) => {
      try {
        // Get the option set with its options - this should work as we've seen it does
        const result = await client.getMetadata<OptionSetMetadata>(
          `GlobalOptionSetDefinitions(Name='${params.name}')`
        );
    
        const options = result.Options?.map(option => ({
          value: option.Value,
          label: option.Label?.UserLocalizedLabel?.Label || "",
          description: option.Description?.UserLocalizedLabel?.Label || "",
          color: option.Color,
          isManaged: option.IsManaged
        })) || [];
    
        return {
          content: [
            {
              type: "text",
              text: `Options for option set '${params.name}':\n\n${JSON.stringify(options, null, 2)}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error retrieving option set options: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod input schema defining the required 'name' parameter for the option set.
    inputSchema: {
      name: z.string().describe("Name of the option set to get options for")
    }
  • The server.registerTool call within the exported getOptionSetOptionsTool function that defines and registers the tool, including its name, metadata (title, description, schema), and handler.
      server.registerTool(
        "get_dataverse_optionset_options",
        {
          title: "Get Dataverse Option Set Options",
          description: "Retrieves all options (choices) within a specific option set, including their values, labels, descriptions, and colors. Use this to inspect the available choices in an option set and understand their configuration.",
          inputSchema: {
            name: z.string().describe("Name of the option set to get options for")
          }
        },
        async (params) => {
          try {
            // Get the option set with its options - this should work as we've seen it does
            const result = await client.getMetadata<OptionSetMetadata>(
              `GlobalOptionSetDefinitions(Name='${params.name}')`
            );
    
            const options = result.Options?.map(option => ({
              value: option.Value,
              label: option.Label?.UserLocalizedLabel?.Label || "",
              description: option.Description?.UserLocalizedLabel?.Label || "",
              color: option.Color,
              isManaged: option.IsManaged
            })) || [];
    
            return {
              content: [
                {
                  type: "text",
                  text: `Options for option set '${params.name}':\n\n${JSON.stringify(options, null, 2)}`
                }
              ]
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error retrieving option set options: ${error instanceof Error ? error.message : 'Unknown error'}`
                }
              ],
              isError: true
            };
          }
        }
      );
    }
  • src/index.ts:164-164 (registration)
    The invocation in the main index file that calls the registration function with the MCP server and Dataverse client instances, thereby registering the tool.
    getOptionSetOptionsTool(server, dataverseClient);
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool retrieves data (implying read-only) but does not disclose behavioral traits such as permissions required, rate limits, pagination, or error handling. The description adds minimal context beyond the basic operation.

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 (two sentences) and front-loaded with the core purpose. Every sentence adds value: the first specifies the action and data, the second provides usage context, with no wasted words.

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

Completeness3/5

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

Given no annotations and no output schema, the description is incomplete for a tool that retrieves data. It covers the purpose and data fields but lacks details on return format, error cases, or behavioral constraints. However, it is adequate for a simple read operation with one parameter.

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% (one parameter 'name' with clear description), so the baseline is 3. The description does not add meaning beyond the schema, as it only mentions 'specific option set' without detailing parameter syntax or format.

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 verb ('Retrieves') and resource ('all options within a specific option set'), specifying the exact data returned (values, labels, descriptions, colors). It distinguishes from sibling tools like 'get_dataverse_optionset' (which likely retrieves metadata) by focusing on the options/choices within the set.

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

Usage Guidelines3/5

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

The description implies usage ('Use this to inspect...') but does not explicitly state when to use this tool versus alternatives like 'get_dataverse_optionset' or 'list_dataverse_optionsets'. It provides a general context (inspecting choices) without exclusions or prerequisites.

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