Skip to main content
Glama

Dynatrace MCP Server

Official
find-monitored-entity-by-name.test.ts2.38 kB
import { DYNATRACE_ENTITY_TYPES_ALL, DYNATRACE_ENTITY_TYPES_BASICS } from '../utils/dynatrace-entity-types'; import { generateDqlSearchEntityCommand } from './find-monitored-entity-by-name'; describe('generateDqlSearchCommand', () => { beforeEach(() => { // Ensure we have at least some entity types for testing expect(DYNATRACE_ENTITY_TYPES_ALL.length).toBeGreaterThan(0); }); it('should include all entity types from DYNATRACE_ENTITY_TYPES_ALL', () => { const entityName = 'test'; const result = generateDqlSearchEntityCommand([entityName], true); console.log(result); // Check that all entity types are included in the DQL DYNATRACE_ENTITY_TYPES_ALL.forEach((entityType) => { expect(result).toContain(`fetch ${entityType}`); }); }); it('should include entity types from DYNATRACE_ENTITY_TYPES_BASICS', () => { const entityName = 'test'; const result = generateDqlSearchEntityCommand([entityName], false); console.log(result); // Check that all entity types are included in the DQL DYNATRACE_ENTITY_TYPES_BASICS.forEach((entityType) => { expect(result).toContain(`fetch ${entityType}`); }); }); it('should structure the DQL correctly with first fetch and subsequent appends', () => { const entityName = 'test'; const result = generateDqlSearchEntityCommand([entityName], true); // First entity type should not have append prefix const firstEntityType = DYNATRACE_ENTITY_TYPES_ALL[0]; expect(result).toContain( `fetch ${firstEntityType} | search "*${entityName}*" | fieldsAdd entity.type | expand tags`, ); // Subsequent entity types should have append prefix (if there are more than 1) if (DYNATRACE_ENTITY_TYPES_ALL.length > 1) { const secondEntityType = DYNATRACE_ENTITY_TYPES_ALL[1]; expect(result).toContain( ` | append [ fetch ${secondEntityType} | search "*${entityName}*" | fieldsAdd entity.type | expand tags ]`, ); } }); it('should handle multiple entityNames correctly', () => { const entityNames = ['test1', 'test2', 'example']; const result = generateDqlSearchEntityCommand(entityNames, true); // Check that the search part includes all entity names joined by OR const searchPart = `search "*test1*" OR "*test2*" OR "*example*"`; expect(result).toContain(searchPart); }); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dynatrace-oss/dynatrace-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server