mcp-think-tank
Version:
Structured thinking and knowledge management tool for Model Context Protocol
82 lines • 2.42 kB
TypeScript
/**
* Entity interface
*/
export interface Entity {
name: string;
entityType: string;
observations: string[];
}
/**
* Relation interface
*/
export interface Relation {
from: string;
to: string;
relationType: string;
}
/**
* KnowledgeGraph class for managing entities and relations
*/
export declare class KnowledgeGraph {
entities: Map<string, Entity>;
relations: Map<string, Set<Relation>>;
constructor();
/**
* Add a new entity to the graph
* @param entity - The entity to add
* @returns true if added, false if already exists
*/
addEntity(entity: Entity): boolean;
/**
* Add a new relation between entities
* @param relation - The relation to add
* @returns true if added, false if invalid or already exists
*/
addRelation(relation: Relation): boolean;
/**
* Add observations to an entity
* @param entityName - The name of the entity
* @param observations - The observations to add
* @returns Array of added observations
*/
addObservations(entityName: string, observations: string[]): string[];
/**
* Delete observations from an entity
* @param entityName - The name of the entity
* @param observations - The observations to delete
* @returns true if entity exists, false otherwise
*/
deleteObservations(entityName: string, observations: string[]): boolean;
/**
* Delete an entity and its relations
* @param entityName - The name of the entity to delete
* @returns true if deleted, false if not found
*/
deleteEntity(entityName: string): boolean;
/**
* Delete a relation
* @param relation - The relation to delete
* @returns true if deleted, false if not found
*/
deleteRelation(relation: Relation): boolean;
/**
* Search for entities based on a query
* @param query - The search query
* @returns Array of matching entities
*/
searchNodes(query: string): Entity[];
/**
* Get entities by name
* @param names - Array of entity names
* @returns Array of found entities
*/
getEntities(names: string[]): Entity[];
/**
* Serialize the entire knowledge graph as a JSON object (for API use, not storage)
*/
toJSON(): {
entities: Entity[];
relations: Relation[];
};
}
//# sourceMappingURL=knowledgeGraph.d.ts.map