get_entity_names
Retrieve entity names from a remote knowledge graph, with options to filter by type and sort by creation date, update date, or name for efficient data management.
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)Primary MCP tool handler for 'get_entity_names'. Delegates to MemoryGraphManager.getEntityNames() and formats the success response with JSON.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 (registration)Registers the 'get_entity_names' tool with the MCP server in the tools list, including description and input schema.{ 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/memory-graph.ts:200-227 (handler)Core implementation of entity names retrieval in MemoryGraphManager: filters by entityType if provided, sorts entities based on options, returns array of 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); }