get_entity_names
Retrieve entity names from a knowledge graph with filtering and sorting options to quickly identify available data entries.
Instructions
엔티티 이름 목록만 조회합니다 (가볍고 빠름)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entityType | No | 특정 엔티티 타입으로 필터링 | |
| sortBy | No | 정렬 기준 (기본값: createdAt) | |
| sortOrder | No | 정렬 순서 (기본값: desc) |
Implementation Reference
- src/index.ts:606-628 (handler)The handler function that processes the get_entity_names tool call, invokes memoryManager.getEntityNames with parameters, and returns a formatted JSON response.private async handleGetEntityNames(args: any) { const names = this.memoryManager.getEntityNames({ entityType: args.entityType, sortBy: args.sortBy, sortOrder: args.sortOrder, }); return { content: [{ type: 'text', text: JSON.stringify({ success: true, names: names, count: names.length, filters: { entityType: args.entityType || 'all', sortBy: args.sortBy || 'createdAt', sortOrder: args.sortOrder || 'desc', }, }, null, 2), }], }; }
- src/index.ts:278-300 (schema)Defines the tool name, description, and input schema in the ListTools response.{ name: 'get_entity_names', description: '엔티티 이름 목록만 조회합니다 (가볍고 빠름)', inputSchema: { type: 'object', properties: { entityType: { type: 'string', description: '특정 엔티티 타입으로 필터링' }, sortBy: { type: 'string', enum: ['createdAt', 'updatedAt', 'name'], description: '정렬 기준 (기본값: createdAt)' }, sortOrder: { type: 'string', enum: ['asc', 'desc'], description: '정렬 순서 (기본값: desc)' } }, }, },
- src/index.ts:398-399 (registration)Switch case in CallToolRequest handler that routes get_entity_names calls to the specific handler function.case 'get_entity_names': return await this.handleGetEntityNames(args);
- src/memory-graph.ts:200-227 (helper)Helper method in MemoryGraphManager that filters entities by type, sorts them according to options, and returns only the entity names.getEntityNames(options?: { entityType?: string; sortBy?: 'createdAt' | 'updatedAt' | 'name'; sortOrder?: 'asc' | 'desc'; }): string[] { let entities = Array.from(this.graph.entities.values()); if (options?.entityType) { entities = entities.filter(e => e.entityType === options.entityType); } const sortBy = options?.sortBy || 'createdAt'; const sortOrder = options?.sortOrder || 'desc'; entities.sort((a, b) => { let aVal: string, bVal: string; if (sortBy === 'name') { aVal = a.name; bVal = b.name; } else { aVal = a[sortBy]; bVal = b[sortBy]; } const comparison = aVal.localeCompare(bVal); return sortOrder === 'asc' ? comparison : -comparison; }); return entities.map(e => e.name); }