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
// 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(); // apiSee
Extends
Constructors
Constructor
new Group(name, nameSeparator?): Group;Defined in: packages/core/src/domain/Group.ts:44
Parameters
| Parameter | Type |
|---|---|
name | string |
nameSeparator? | string |
Returns
Group
Overrides
BaseModel.constructorProperties
childGroups
readonly childGroups: Group[];Defined in: packages/core/src/domain/Group.ts:36
Direct child groups in this container
childPrompts
readonly childPrompts: Prompt[];Defined in: packages/core/src/domain/Group.ts:40
Prompts contained in this group
childResources
readonly childResources: Resource[];Defined in: packages/core/src/domain/Group.ts:42
Resources contained in this group
childTools
readonly childTools: Tool[];Defined in: packages/core/src/domain/Group.ts:38
Tools contained in this group
description
description: string | undefined;Defined in: packages/core/src/domain/BaseModel.ts:33
Detailed description of this entity's purpose
Inherited from
icons
icons: Icon[] | undefined;Defined in: packages/core/src/domain/BaseModel.ts:37
Visual icons associated with this entity
Inherited from
meta
meta: Map<string, unknown> | undefined;Defined in: packages/core/src/domain/BaseModel.ts:35
Arbitrary key-value metadata for extensibility
Inherited from
name
readonly name: string;Defined in: packages/core/src/domain/BaseModel.ts:29
Unique identifier within the parent scope
Inherited from
nameSeparator
readonly nameSeparator: string;Defined in: packages/core/src/domain/BaseModel.ts:27
Separator character for constructing fully qualified names
Inherited from
parent
parent: Group | null = null;Defined in: packages/core/src/domain/Group.ts:34
Parent group (null if this is a root node)
title
title: string | undefined;Defined in: packages/core/src/domain/BaseModel.ts:31
Human-readable display title
Inherited from
DEFAULT_SEPARATOR
readonly static DEFAULT_SEPARATOR: string = ".";Defined in: packages/core/src/domain/BaseModel.ts:24
Default separator used in fully qualified names
Inherited from
Methods
addChildGroup()
addChildGroup(childGroup): boolean;Defined in: packages/core/src/domain/Group.ts:99
Add a child group to this container.
Parameters
| Parameter | Type | Description |
|---|---|---|
childGroup | Group | The group to nest under this one |
Returns
boolean
false if already a child, true if added
addChildPrompt()
addChildPrompt(childPrompt): boolean;Defined in: packages/core/src/domain/Group.ts:137
Add a prompt to this group. Returns false if already present.
Parameters
| Parameter | Type |
|---|---|
childPrompt | Prompt |
Returns
boolean
addChildResource()
addChildResource(childResource): boolean;Defined in: packages/core/src/domain/Group.ts:147
Add a resource to this group. Returns false if already present.
Parameters
| Parameter | Type |
|---|---|
childResource | Resource |
Returns
boolean
addChildTool()
addChildTool(childTool): boolean;Defined in: packages/core/src/domain/Group.ts:127
Add a tool to this group. Returns false if already present.
Parameters
| Parameter | Type |
|---|---|
childTool | Tool |
Returns
boolean
getFullyQualifiedName()
getFullyQualifiedName(): string;Defined in: packages/core/src/domain/Group.ts:178
Returns the dot-separated fully qualified name.
Returns
string
Example
const root = new Group('api');
const v2 = new Group('v2');
root.addChildGroup(v2);
v2.getFullyQualifiedName(); // "api.v2"Overrides
BaseModel.getFullyQualifiedName
getRoot()
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
const root = new Group('api');
const child = new Group('users');
root.addChildGroup(child);
child.getRoot(); // rootisRoot()
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()
removeChildGroup(childGroup): boolean;Defined in: packages/core/src/domain/Group.ts:118
Remove a child group from this container.
Parameters
| Parameter | Type | Description |
|---|---|---|
childGroup | Group | The group to remove |
Returns
boolean
false if not found, true if removed
removeChildPrompt()
removeChildPrompt(childPrompt): boolean;Defined in: packages/core/src/domain/Group.ts:142
Remove a prompt from this group. Returns false if not found.
Parameters
| Parameter | Type |
|---|---|
childPrompt | Prompt |
Returns
boolean
removeChildResource()
removeChildResource(childResource): boolean;Defined in: packages/core/src/domain/Group.ts:152
Remove a resource from this group. Returns false if not found.
Parameters
| Parameter | Type |
|---|---|
childResource | Resource |
Returns
boolean
removeChildTool()
removeChildTool(childTool): boolean;Defined in: packages/core/src/domain/Group.ts:132
Remove a tool from this group. Returns false if not found.
Parameters
| Parameter | Type |
|---|---|
childTool | Tool |
Returns
boolean