get-global-option-set
Retrieve the definition of a global option set by specifying its name, enabling precise metadata access within the PowerPlatform/Dataverse environment.
Instructions
Get a global option set definition by name
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| optionSetName | Yes | The name of the global option set |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"optionSetName": {
"description": "The name of the global option set",
"type": "string"
}
},
"required": [
"optionSetName"
],
"type": "object"
}
Implementation Reference
- src/index.ts:509-537 (handler)The MCP tool handler function that calls PowerPlatformService.getGlobalOptionSet, formats the JSON response as text content.async ({ optionSetName }) => { try { // Get or initialize PowerPlatformService const service = getPowerPlatformService(); const optionSet = await service.getGlobalOptionSet(optionSetName); // Format the option set as a string for text display const optionSetStr = JSON.stringify(optionSet, null, 2); return { content: [ { type: "text", text: `Global option set '${optionSetName}':\n\n${optionSetStr}`, }, ], }; } catch (error: any) { console.error("Error getting global option set:", error); return { content: [ { type: "text", text: `Failed to get global option set: ${error.message}`, }, ], }; } }
- src/index.ts:506-508 (schema)Zod input schema defining 'optionSetName' parameter for the tool.{ optionSetName: z.string().describe("The name of the global option set"), },
- src/index.ts:503-538 (registration)Registration of the 'get-global-option-set' tool using McpServer.tool() method, including name, description, input schema, and handler.server.tool( "get-global-option-set", "Get a global option set definition by name", { optionSetName: z.string().describe("The name of the global option set"), }, async ({ optionSetName }) => { try { // Get or initialize PowerPlatformService const service = getPowerPlatformService(); const optionSet = await service.getGlobalOptionSet(optionSetName); // Format the option set as a string for text display const optionSetStr = JSON.stringify(optionSet, null, 2); return { content: [ { type: "text", text: `Global option set '${optionSetName}':\n\n${optionSetStr}`, }, ], }; } catch (error: any) { console.error("Error getting global option set:", error); return { content: [ { type: "text", text: `Failed to get global option set: ${error.message}`, }, ], }; } } );
- src/PowerPlatformService.ts:239-241 (helper)Helper method in PowerPlatformService class that makes the authenticated API request to retrieve the global option set metadata from Dataverse.async getGlobalOptionSet(optionSetName: string): Promise<any> { return this.makeRequest(`api/data/v9.2/GlobalOptionSetDefinitions(Name='${optionSetName}')`); }