Skip to content

Commit ea386a5

Browse files
Merge pull request modelcontextprotocol#38 from modelcontextprotocol/justin/clarify-model-hints
Split out a `ModelHint` type for clarity
2 parents 359dd85 + 0cc9ae7 commit ea386a5

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

schema/schema.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,16 @@
10091009
],
10101010
"type": "object"
10111011
},
1012+
"ModelHint": {
1013+
"description": "Hints to use for model selection.\n\nKeys not declared here are currently left unspecified by the spec and are up\nto the client to interpret.",
1014+
"properties": {
1015+
"name": {
1016+
"description": "A hint for a model name.\n\nThe client SHOULD treat this as a substring of a model name; for example:\n - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\n - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\n - `claude` should match any Claude model\n\nThe client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n - `gemini-1.5-flash` could match `claude-3-haiku-20240307`",
1017+
"type": "string"
1018+
}
1019+
},
1020+
"type": "object"
1021+
},
10121022
"ModelPreferences": {
10131023
"description": "The server's preferences for model selection, requested of the client during sampling.\n\nBecause LLMs can vary along multiple dimensions, choosing the \"best\" model is\nrarely straightforward. Different models excel in different areas—some are\nfaster but less capable, others are more capable but more expensive, and so\non. This interface allows servers to express their priorities across multiple\ndimensions to help clients make an appropriate selection for their use case.\n\nThese preferences are always advisory. The client MAY ignore them. It is also\nup to the client to decide how to interpret these preferences and how to\nbalance them against other considerations.",
10141024
"properties": {
@@ -1019,9 +1029,9 @@
10191029
"type": "number"
10201030
},
10211031
"hints": {
1022-
"description": "Optional string hints to use for model selection. How these hints are\ninterpreted depends on the key(s) in each record:\n\n- If the record contains a `name` key:\n - The client SHOULD treat this as a substring of a model name; for example:\n - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\n - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\n - `claude` should match any Claude model\n - The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n - `gemini-1.5-flash` could match `claude-3-haiku-20240307`\n\nAll other keys are currently left unspecified by the spec and are up to the\nclient to interpret.\n\nIf multiple hints are specified, the client MUST evaluate them in order\n(such that the first match is taken).\n\nThe client SHOULD prioritize these hints over the numeric priorities, but\nMAY still use the priorities to select from ambiguous matches.",
1032+
"description": "Optional hints to use for model selection.\n\nIf multiple hints are specified, the client MUST evaluate them in order\n(such that the first match is taken).\n\nThe client SHOULD prioritize these hints over the numeric priorities, but\nMAY still use the priorities to select from ambiguous matches.",
10231033
"items": {
1024-
"$ref": "#/definitions/Record<string,string>"
1034+
"$ref": "#/definitions/ModelHint"
10251035
},
10261036
"type": "array"
10271037
},
@@ -1337,9 +1347,6 @@
13371347
],
13381348
"type": "object"
13391349
},
1340-
"Record<string,string>": {
1341-
"type": "object"
1342-
},
13431350
"Request": {
13441351
"properties": {
13451352
"method": {

schema/schema.ts

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -806,27 +806,15 @@ export interface ImageContent {
806806
*/
807807
export interface ModelPreferences {
808808
/**
809-
* Optional string hints to use for model selection. How these hints are
810-
* interpreted depends on the key(s) in each record:
811-
*
812-
* - If the record contains a `name` key:
813-
* - The client SHOULD treat this as a substring of a model name; for example:
814-
* - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`
815-
* - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.
816-
* - `claude` should match any Claude model
817-
* - The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:
818-
* - `gemini-1.5-flash` could match `claude-3-haiku-20240307`
819-
*
820-
* All other keys are currently left unspecified by the spec and are up to the
821-
* client to interpret.
809+
* Optional hints to use for model selection.
822810
*
823811
* If multiple hints are specified, the client MUST evaluate them in order
824812
* (such that the first match is taken).
825813
*
826814
* The client SHOULD prioritize these hints over the numeric priorities, but
827815
* MAY still use the priorities to select from ambiguous matches.
828816
*/
829-
hints?: Record<"name" | string, string>[];
817+
hints?: ModelHint[];
830818

831819
/**
832820
* How much to prioritize cost when selecting a model. A value of 0 means cost
@@ -862,6 +850,27 @@ export interface ModelPreferences {
862850
intelligencePriority?: number;
863851
}
864852

853+
/**
854+
* Hints to use for model selection.
855+
*
856+
* Keys not declared here are currently left unspecified by the spec and are up
857+
* to the client to interpret.
858+
*/
859+
export interface ModelHint {
860+
/**
861+
* A hint for a model name.
862+
*
863+
* The client SHOULD treat this as a substring of a model name; for example:
864+
* - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`
865+
* - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.
866+
* - `claude` should match any Claude model
867+
*
868+
* The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:
869+
* - `gemini-1.5-flash` could match `claude-3-haiku-20240307`
870+
*/
871+
name?: string;
872+
}
873+
865874
/* Autocomplete */
866875
/**
867876
* A request from the client to the server, to ask for completion options.

0 commit comments

Comments
 (0)