Get Dataverse Option Set Options
get_dataverse_optionset_optionsRetrieve 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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>"
},
"name": "get_dataverse_optionset_options"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the option set to get options for |
Implementation Reference
- src/tools/optionset-tools.ts:388-422 (handler)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 }; } } - src/tools/optionset-tools.ts:384-386 (schema)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") } - src/tools/optionset-tools.ts:379-424 (registration)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);