get-entity-attribute
Retrieve specific attribute details from PowerPlatform entities to access metadata and field information for development and integration tasks.
Instructions
Get a specific attribute/field of a PowerPlatform entity
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entityName | Yes | The logical name of the entity | |
| attributeName | Yes | The logical name of the attribute |
Implementation Reference
- src/index.ts:433-462 (handler)Handler function for the 'get-entity-attribute' MCP tool. Delegates to PowerPlatformService.getEntityAttribute and formats the response as text.async ({ entityName, attributeName }) => { try { // Get or initialize PowerPlatformService const service = getPowerPlatformService(); const attribute = await service.getEntityAttribute(entityName, attributeName); // Format the attribute as a string for text display const attributeStr = JSON.stringify(attribute, null, 2); return { content: [ { type: "text", text: `Attribute '${attributeName}' for entity '${entityName}':\n\n${attributeStr}`, }, ], }; } catch (error: any) { console.error("Error getting entity attribute:", error); return { content: [ { type: "text", text: `Failed to get entity attribute: ${error.message}`, }, ], }; } } );
- src/index.ts:429-432 (schema)Zod input schema defining parameters for entityName and attributeName.{ entityName: z.string().describe("The logical name of the entity"), attributeName: z.string().describe("The logical name of the attribute") },
- src/index.ts:426-465 (registration)Registration of the 'get-entity-attribute' tool using server.tool, including schema and handler.server.tool( "get-entity-attribute", "Get a specific attribute/field of a PowerPlatform entity", { entityName: z.string().describe("The logical name of the entity"), attributeName: z.string().describe("The logical name of the attribute") }, async ({ entityName, attributeName }) => { try { // Get or initialize PowerPlatformService const service = getPowerPlatformService(); const attribute = await service.getEntityAttribute(entityName, attributeName); // Format the attribute as a string for text display const attributeStr = JSON.stringify(attribute, null, 2); return { content: [ { type: "text", text: `Attribute '${attributeName}' for entity '${entityName}':\n\n${attributeStr}`, }, ], }; } catch (error: any) { console.error("Error getting entity attribute:", error); return { content: [ { type: "text", text: `Failed to get entity attribute: ${error.message}`, }, ], }; } } ); // PowerPlatform entity relationships server.tool(
- src/PowerPlatformService.ts:165-167 (helper)Supporting method in PowerPlatformService that performs the actual API request to fetch the specific entity attribute metadata.async getEntityAttribute(entityName: string, attributeName: string): Promise<any> { return this.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityName}')/Attributes(LogicalName='${attributeName}')`); }