Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

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);

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