Skip to content

Commit bd567fb

Browse files
fix: Improve filtering for find_entity_by_name tool
1 parent 4702036 commit bd567fb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased Changes
44

5+
- Fixed an issue with `find_entity_by_name` tool filtering out valid entries
6+
57
## 0.10.0
68

79
### Tools

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,13 @@ const main = async () => {
504504
const result = await findMonitoredEntitiesByName(dtClient, entityNames, extendedSearch);
505505

506506
if (result && result.records && result.records.length > 0) {
507+
console.error(
508+
`Found ${result.records.length} entities via classic entities API, filtering out the invalid ones.`,
509+
);
507510
// Filter valid entities first, to ensure we display up to maxEntitiesToDisplay entities
508511
const validClassicEntities = result.records.filter(
509512
(entity): entity is { id: string; type: string; name: string; [key: string]: any } =>
510-
!!(entity && entity.id && entity.type && entity.name),
513+
!!(entity && entity.id && entity['entity.type'] && entity['entity.name']),
511514
);
512515

513516
let resp = `Found ${validClassicEntities.length} monitored entities! Displaying the first ${Math.min(maxEntitiesToDisplay, validClassicEntities.length)} entities:\n`;

0 commit comments

Comments
 (0)