Skip to content

Class: Group

Defined in: packages/core/src/domain/Group.ts:32

Represents a hierarchical group (tree node) in the MCP domain model.

Groups can contain child groups, tools, prompts, and resources. Supports fully qualified names via recursive parent traversal.

Example

typescript
// Build a hierarchy
const api = new Group('api');
const v2 = new Group('v2');
api.addChildGroup(v2);

const readFile = new Tool('read_file');
v2.addChildTool(readFile);

v2.getFullyQualifiedName();  // "api.v2"
api.isRoot();                // true
v2.getRoot();                // api

See

Extends

Constructors

Constructor

ts
new Group(name, nameSeparator?): Group;

Defined in: packages/core/src/domain/Group.ts:44

Parameters

ParameterType
namestring
nameSeparator?string

Returns

Group

Overrides

ts
BaseModel.constructor

Properties

childGroups

ts
readonly childGroups: Group[];

Defined in: packages/core/src/domain/Group.ts:36

Direct child groups in this container


childPrompts

ts
readonly childPrompts: Prompt[];

Defined in: packages/core/src/domain/Group.ts:40

Prompts contained in this group


childResources

ts
readonly childResources: Resource[];

Defined in: packages/core/src/domain/Group.ts:42

Resources contained in this group


childTools

ts
readonly childTools: Tool[];

Defined in: packages/core/src/domain/Group.ts:38

Tools contained in this group


description

ts
description: string | undefined;

Defined in: packages/core/src/domain/BaseModel.ts:33

Detailed description of this entity's purpose

Inherited from

BaseModel.description


icons

ts
icons: Icon[] | undefined;

Defined in: packages/core/src/domain/BaseModel.ts:37

Visual icons associated with this entity

Inherited from

BaseModel.icons


meta

ts
meta: Map<string, unknown> | undefined;

Defined in: packages/core/src/domain/BaseModel.ts:35

Arbitrary key-value metadata for extensibility

Inherited from

BaseModel.meta


name

ts
readonly name: string;

Defined in: packages/core/src/domain/BaseModel.ts:29

Unique identifier within the parent scope

Inherited from

BaseModel.name


nameSeparator

ts
readonly nameSeparator: string;

Defined in: packages/core/src/domain/BaseModel.ts:27

Separator character for constructing fully qualified names

Inherited from

BaseModel.nameSeparator


parent

ts
parent: Group | null = null;

Defined in: packages/core/src/domain/Group.ts:34

Parent group (null if this is a root node)


title

ts
title: string | undefined;

Defined in: packages/core/src/domain/BaseModel.ts:31

Human-readable display title

Inherited from

BaseModel.title


DEFAULT_SEPARATOR

ts
readonly static DEFAULT_SEPARATOR: string = ".";

Defined in: packages/core/src/domain/BaseModel.ts:24

Default separator used in fully qualified names

Inherited from

BaseModel.DEFAULT_SEPARATOR

Methods

addChildGroup()

ts
addChildGroup(childGroup): boolean;

Defined in: packages/core/src/domain/Group.ts:99

Add a child group to this container.

Parameters

ParameterTypeDescription
childGroupGroupThe group to nest under this one

Returns

boolean

false if already a child, true if added


addChildPrompt()

ts
addChildPrompt(childPrompt): boolean;

Defined in: packages/core/src/domain/Group.ts:137

Add a prompt to this group. Returns false if already present.

Parameters

ParameterType
childPromptPrompt

Returns

boolean


addChildResource()

ts
addChildResource(childResource): boolean;

Defined in: packages/core/src/domain/Group.ts:147

Add a resource to this group. Returns false if already present.

Parameters

ParameterType
childResourceResource

Returns

boolean


addChildTool()

ts
addChildTool(childTool): boolean;

Defined in: packages/core/src/domain/Group.ts:127

Add a tool to this group. Returns false if already present.

Parameters

ParameterType
childToolTool

Returns

boolean


getFullyQualifiedName()

ts
getFullyQualifiedName(): string;

Defined in: packages/core/src/domain/Group.ts:178

Returns the dot-separated fully qualified name.

Returns

string

Example

typescript
const root = new Group('api');
const v2 = new Group('v2');
root.addChildGroup(v2);
v2.getFullyQualifiedName(); // "api.v2"

Overrides

BaseModel.getFullyQualifiedName


getRoot()

ts
getRoot(): Group;

Defined in: packages/core/src/domain/Group.ts:82

Traverse to the root of the tree.

Returns

Group

The topmost ancestor group

Example

typescript
const root = new Group('api');
const child = new Group('users');
root.addChildGroup(child);
child.getRoot(); // root

isRoot()

ts
isRoot(): boolean;

Defined in: packages/core/src/domain/Group.ts:87

Returns true if this group has no parent (is a root node).

Returns

boolean


removeChildGroup()

ts
removeChildGroup(childGroup): boolean;

Defined in: packages/core/src/domain/Group.ts:118

Remove a child group from this container.

Parameters

ParameterTypeDescription
childGroupGroupThe group to remove

Returns

boolean

false if not found, true if removed


removeChildPrompt()

ts
removeChildPrompt(childPrompt): boolean;

Defined in: packages/core/src/domain/Group.ts:142

Remove a prompt from this group. Returns false if not found.

Parameters

ParameterType
childPromptPrompt

Returns

boolean


removeChildResource()

ts
removeChildResource(childResource): boolean;

Defined in: packages/core/src/domain/Group.ts:152

Remove a resource from this group. Returns false if not found.

Parameters

ParameterType
childResourceResource

Returns

boolean


removeChildTool()

ts
removeChildTool(childTool): boolean;

Defined in: packages/core/src/domain/Group.ts:132

Remove a tool from this group. Returns false if not found.

Parameters

ParameterType
childToolTool

Returns

boolean