Skip to main content
Glama

list_entities

Retrieve and manage knowledge graph entities from remote memory storage with filtering, sorting, and pagination options.

Instructions

엔티티 목록을 조회합니다 (필터링, 정렬, 페이지네이션 지원)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entityTypeNo특정 엔티티 타입으로 필터링
sortByNo정렬 기준 (기본값: createdAt)
sortOrderNo정렬 순서 (기본값: desc)
dateFromNo시작 날짜 (ISO 8601 형식)
dateToNo종료 날짜 (ISO 8601 형식)
limitNo페이지 크기 (기본값: 50)
offsetNo시작 위치 (기본값: 0)

Implementation Reference

  • MCP tool handler for list_entities: delegates to memoryManager.listEntities and formats JSON response with pagination info.
    private async handleListEntities(args: any) { const result = this.memoryManager.listEntities({ entityType: args.entityType, sortBy: args.sortBy, sortOrder: args.sortOrder, dateFrom: args.dateFrom, dateTo: args.dateTo, limit: args.limit, offset: args.offset, }); return { content: [{ type: 'text', text: JSON.stringify({ success: true, entities: result.entities, count: result.entities.length, total: result.total, offset: args.offset || 0, limit: args.limit || 50, hasMore: (args.offset || 0) + result.entities.length < result.total, }, null, 2), }], }; }
  • Input schema defining parameters for filtering, sorting, and paginating entities.
    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)' }, dateFrom: { type: 'string', description: '시작 날짜 (ISO 8601 형식)' }, dateTo: { type: 'string', description: '종료 날짜 (ISO 8601 형식)' }, limit: { type: 'number', description: '페이지 크기 (기본값: 50)' }, offset: { type: 'number', description: '시작 위치 (기본값: 0)' } }, },
  • src/index.ts:239-277 (registration)
    Registration of the list_entities tool in the tools list returned by ListToolsRequestSchema, including name, description, and schema.
    { name: 'list_entities', 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)' }, dateFrom: { type: 'string', description: '시작 날짜 (ISO 8601 형식)' }, dateTo: { type: 'string', description: '종료 날짜 (ISO 8601 형식)' }, limit: { type: 'number', description: '페이지 크기 (기본값: 50)' }, offset: { type: 'number', description: '시작 위치 (기본값: 0)' } }, }, },
  • Core helper method implementing entity listing with filtering by type/date, sorting, and pagination.
    listEntities(options?: { entityType?: string; sortBy?: 'createdAt' | 'updatedAt' | 'name'; sortOrder?: 'asc' | 'desc'; dateFrom?: string; dateTo?: string; limit?: number; offset?: number; }): { entities: Entity[]; total: number } { let entities = Array.from(this.graph.entities.values()); // EntityType 필터링 if (options?.entityType) { entities = entities.filter(e => e.entityType === options.entityType); } // 날짜 범위 필터링 if (options?.dateFrom) { entities = entities.filter(e => e.createdAt >= options.dateFrom!); } if (options?.dateTo) { entities = entities.filter(e => e.createdAt <= options.dateTo!); } // 정렬 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; }); const total = entities.length; // 페이지네이션 if (options?.offset !== undefined || options?.limit !== undefined) { const offset = options.offset || 0; const limit = options.limit || 50; entities = entities.slice(offset, offset + limit); } return { entities, total };

Latest Blog Posts

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/YeomYuJun/remote-memory-mcp-server'

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