powerplatform-mcp 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,7 +73,12 @@ export class PowerPlatformService {
73
73
  * @param entityName The logical name of the entity
74
74
  */
75
75
  async getEntityMetadata(entityName) {
76
- return this.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityName}')`);
76
+ const response = await this.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityName}')`);
77
+ // Remove Privileges property if it exists
78
+ if (response && typeof response === 'object' && 'Privileges' in response) {
79
+ delete response.Privileges;
80
+ }
81
+ return response;
77
82
  }
78
83
  /**
79
84
  * Get metadata about entity attributes/fields
@@ -81,10 +86,40 @@ export class PowerPlatformService {
81
86
  */
82
87
  async getEntityAttributes(entityName) {
83
88
  const selectProperties = [
84
- 'AttributeType',
85
89
  'LogicalName',
86
90
  ].join(',');
87
- return this.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityName}')/Attributes?$select=${selectProperties}&$filter=AttributeType ne 'Virtual'`);
91
+ // Make the request to get attributes
92
+ const response = await this.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityName}')/Attributes?$select=${selectProperties}&$filter=AttributeType ne 'Virtual'`);
93
+ if (response && response.value) {
94
+ // First pass: Filter out attributes that end with 'yominame'
95
+ response.value = response.value.filter((attribute) => {
96
+ const logicalName = attribute.LogicalName || '';
97
+ return !logicalName.endsWith('yominame');
98
+ });
99
+ // Filter out attributes that end with 'name' if there is another attribute with the same name without the 'name' suffix
100
+ const baseNames = new Set();
101
+ const namesAttributes = new Map();
102
+ for (const attribute of response.value) {
103
+ const logicalName = attribute.LogicalName || '';
104
+ if (logicalName.endsWith('name') && logicalName.length > 4) {
105
+ const baseName = logicalName.slice(0, -4); // Remove 'name' suffix
106
+ namesAttributes.set(baseName, attribute);
107
+ }
108
+ else {
109
+ // This is a potential base attribute
110
+ baseNames.add(logicalName);
111
+ }
112
+ }
113
+ // Find attributes to remove that match the pattern
114
+ const attributesToRemove = new Set();
115
+ for (const [baseName, nameAttribute] of namesAttributes.entries()) {
116
+ if (baseNames.has(baseName)) {
117
+ attributesToRemove.add(nameAttribute);
118
+ }
119
+ }
120
+ response.value = response.value.filter(attribute => !attributesToRemove.has(attribute));
121
+ }
122
+ return response;
88
123
  }
89
124
  /**
90
125
  * Get metadata about a specific entity attribute/field
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerplatform-mcp",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "PowerPlatform Model Context Protocol server",
5
5
  "main": "build/index.js",
6
6
  "bin": {