Skip to content

Commit 2931d90

Browse files
committed
Fix the _meta field for all types that need meta with groups.
1 parent 651ad2a commit 2931d90

2 files changed

Lines changed: 79 additions & 15 deletions

File tree

schema/draft/schema.json

Lines changed: 38 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/draft/schema.ts

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ export const GROUPS_META_KEY = 'io.modelcontextprotocol/groups';
3636
*/
3737
export type MetaObject = Record<string, unknown>;
3838

39+
/**
40+
* Represents a metadata object extended with an additional property for grouping.
41+
*
42+
* Extends the base `MetaObject` and includes an optional field
43+
* `io.modelcontextprotocol/groups` that specifies a list of groups names
44+
*/
45+
export type MetaWithGroups = MetaObject & { 'io.modelcontextprotocol/groups'?: string[] };
46+
3947
/**
4048
* Extends {@link MetaObject} with additional request-specific fields. All key naming rules from `MetaObject` apply.
4149
*
@@ -1170,7 +1178,12 @@ export interface Resource extends BaseMetadata, Icons {
11701178
*/
11711179
size?: number;
11721180

1173-
_meta?: MetaObject;
1181+
/**
1182+
* Like `MetaObject` but if the group metadata key
1183+
* is present, must contain an array of strings (group names)
1184+
*/
1185+
_meta?: MetaWithGroups
1186+
11741187
}
11751188

11761189
/**
@@ -1203,7 +1216,11 @@ export interface ResourceTemplate extends BaseMetadata, Icons {
12031216
*/
12041217
annotations?: Annotations;
12051218

1206-
_meta?: MetaObject;
1219+
/**
1220+
* Like `MetaObject` but if the group metadata key
1221+
* is present, must contain an array of strings (group names)
1222+
*/
1223+
_meta?: MetaWithGroups
12071224
}
12081225

12091226
/**
@@ -1367,7 +1384,11 @@ export interface Prompt extends BaseMetadata, Icons {
13671384
*/
13681385
arguments?: PromptArgument[];
13691386

1370-
_meta?: MetaObject;
1387+
/**
1388+
* Like `MetaObject` but if the group metadata key
1389+
* is present, must contain an array of strings (group names)
1390+
*/
1391+
_meta?: MetaWithGroups
13711392
}
13721393

13731394
/**
@@ -1731,7 +1752,11 @@ export interface Tool extends BaseMetadata, Icons {
17311752
*/
17321753
annotations?: ToolAnnotations;
17331754

1734-
_meta?: MetaObject;
1755+
/**
1756+
* Like `MetaObject` but if the group metadata key
1757+
* is present, must contain an array of strings (group names)
1758+
*/
1759+
_meta?: MetaWithGroups
17351760
}
17361761

17371762
/* Tasks */
@@ -1818,6 +1843,12 @@ export interface Task {
18181843
* Suggested polling interval in milliseconds.
18191844
*/
18201845
pollInterval?: number;
1846+
1847+
/**
1848+
* Like `MetaObject` but contains optional keys
1849+
* that, if present, must have the defined value type
1850+
*/
1851+
_meta?: Record<string, unknown>
18211852
}
18221853

18231854
/**
@@ -2055,11 +2086,12 @@ export interface Group extends BaseMetadata, Icons {
20552086
*/
20562087
annotations?: Annotations;
20572088

2058-
_meta: z.optional(
2059-
z.looseObject({
2060-
[GROUPS_META_KEY]: z.array(z.string()).optional()
2061-
})
2062-
)
2089+
/**
2090+
* Like `MetaObject` but if the group metadata key
2091+
* is present, must contain an array of strings (group names)
2092+
*/
2093+
_meta?: MetaWithGroups
2094+
20632095
}
20642096

20652097
/* Logging */

0 commit comments

Comments
 (0)