Skip to content

Commit 3a96a59

Browse files
bhosmer-antclaude
andcommitted
Refactor tool annotations to add effectHints property
- Replace readOnly property with more descriptive effectHints object - Rename openWorld to openWorldHint to clarify it's a hint - Add additional tool effect properties (destructive, idempotent) - Clarify these properties are hints only in documentation - Remove unused DisplayAnnotations interface 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c17ee30 commit 3a96a59

File tree

2 files changed

+70
-87
lines changed

2 files changed

+70
-87
lines changed

schema/draft/schema.json

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -464,35 +464,6 @@
464464
"description": "An opaque token used to represent a cursor for pagination.",
465465
"type": "string"
466466
},
467-
"DisplayAnnotations": {
468-
"description": "Annotations that provide display-facing information to the client.",
469-
"properties": {
470-
"icon": {
471-
"properties": {
472-
"contentType": {
473-
"type": "string"
474-
},
475-
"data": {
476-
"type": "string"
477-
}
478-
},
479-
"required": [
480-
"contentType",
481-
"data"
482-
],
483-
"type": "object"
484-
},
485-
"icon_url": {
486-
"description": "A URL from which a client can fetch an icon to represent this object.",
487-
"type": "string"
488-
},
489-
"title": {
490-
"description": "A human-readable title for the object or data.",
491-
"type": "string"
492-
}
493-
},
494-
"type": "object"
495-
},
496467
"EmbeddedResource": {
497468
"description": "The contents of a resource, embedded into a prompt or tool call result.\n\nIt is up to the client how best to render embedded resources for the benefit\nof the LLM and/or the user.",
498469
"properties": {
@@ -1969,7 +1940,7 @@
19691940
"properties": {
19701941
"annotations": {
19711942
"$ref": "#/definitions/ToolAnnotations",
1972-
"description": "Annotations"
1943+
"description": "Optional additional tool information."
19731944
},
19741945
"description": {
19751946
"description": "A human-readable description of the tool.\n\nThis can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a \"hint\" to the model.",
@@ -2014,37 +1985,49 @@
20141985
"type": "object"
20151986
},
20161987
"ToolAnnotations": {
2017-
"description": "Annotations that provide display-facing and operational information for a Tool.",
1988+
"description": "Additional properties describing a Tool to clients.",
20181989
"properties": {
2019-
"icon": {
2020-
"properties": {
2021-
"contentType": {
2022-
"type": "string"
1990+
"effectHints": {
1991+
"anyOf": [
1992+
{
1993+
"properties": {
1994+
"readOnly": {
1995+
"const": true,
1996+
"type": "boolean"
1997+
}
1998+
},
1999+
"required": [
2000+
"readOnly"
2001+
],
2002+
"type": "object"
20232003
},
2024-
"data": {
2025-
"type": "string"
2004+
{
2005+
"properties": {
2006+
"destructive": {
2007+
"type": "boolean"
2008+
},
2009+
"idempotent": {
2010+
"type": "boolean"
2011+
},
2012+
"readOnly": {
2013+
"const": false,
2014+
"type": "boolean"
2015+
}
2016+
},
2017+
"required": [
2018+
"readOnly"
2019+
],
2020+
"type": "object"
20262021
}
2027-
},
2028-
"required": [
2029-
"contentType",
2030-
"data"
20312022
],
2032-
"type": "object"
2033-
},
2034-
"icon_url": {
2035-
"description": "A URL from which a client can fetch an icon to represent this object.",
2036-
"type": "string"
2037-
},
2038-
"openWorld": {
2039-
"description": "If true, this tool may interact with an open set of \"external\"\nentities, e.g. by making web queries.\n\nIf not set, this is assumed to be true.",
2040-
"type": "boolean"
2023+
"description": "Describes the effects a tool may have on its environment.\n\nNOTE: these properties are **hints**. They do not guarantee tool behavior.\n\nIf not set, this property is assumed to have the value:\n { readOnly: false, destructive: true, idempotent: false }"
20412024
},
2042-
"readOnly": {
2043-
"description": "If true, this tool does not perform writes or updates,\nor otherwise change server-side state in ways that would\nbe visible in subsequent tool calls.\n\nIf not set, this is assumed to be false.",
2025+
"openWorldHint": {
2026+
"description": "If true, this tool may interact with an \"open world\" of external\nentities. If false, the tool's domain of interaction is closed.\nFor example, the world of a web search tool is open, whereas that\nof a memory tool is not.\n\nNOTE: this property is a **hint**. It does not guarantee tool behavior.\n\nIf not set, this is assumed to be true.",
20442027
"type": "boolean"
20452028
},
20462029
"title": {
2047-
"description": "A human-readable title for the object or data.",
2030+
"description": "A human-readable title for the tool.",
20482031
"type": "string"
20492032
}
20502033
},

schema/draft/schema.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -697,45 +697,47 @@ export interface ToolListChangedNotification extends Notification {
697697
}
698698

699699
/**
700-
* Annotations that provide display-facing information to the client.
700+
* Additional properties describing a Tool to clients.
701701
*/
702-
export interface DisplayAnnotations {
702+
export interface ToolAnnotations {
703703
/**
704-
* A human-readable title for the object or data.
704+
* A human-readable title for the tool.
705705
*/
706706
title?: string;
707707

708-
icon?: {
709-
data: string; // base64-encoded image data
710-
contentType: string; // MIME type of the image
711-
};
712-
713-
/**
714-
* A URL from which a client can fetch an icon to represent this object.
715-
*/
716-
icon_url?: string;
717-
}
718-
719-
/**
720-
* Annotations that provide display-facing and operational information for a Tool.
721-
*/
722-
export interface ToolAnnotations extends DisplayAnnotations {
723708
/**
724-
* If true, this tool does not perform writes or updates,
725-
* or otherwise change server-side state in ways that would
726-
* be visible in subsequent tool calls.
709+
* Describes the effects a tool may have on its environment.
710+
*
711+
* NOTE: these properties are **hints**. They do not guarantee tool behavior.
727712
*
728-
* If not set, this is assumed to be false.
729-
*/
730-
readOnly?: boolean;
731-
732-
/**
733-
* If true, this tool may interact with an open set of "external"
734-
* entities, e.g. by making web queries.
713+
* If not set, this property is assumed to have the value:
714+
* { readOnly: false, destructive: true, idempotent: false }
715+
*/
716+
effectHints?:
717+
| {
718+
/* Tool is read-only. */
719+
readOnly: true;
720+
}
721+
| {
722+
/* Tool is read-write. */
723+
readOnly: false;
724+
/* If true, tool may perform destructive updates to its environment, as opposed to only additive updates. Default: true */
725+
destructive?: boolean;
726+
/* If true, repeated calls with the same arguments will have no additional effects. Default: false */
727+
idempotent?: boolean;
728+
};
729+
730+
/**
731+
* If true, this tool may interact with an "open world" of external
732+
* entities. If false, the tool's domain of interaction is closed.
733+
* For example, the world of a web search tool is open, whereas that
734+
* of a memory tool is not.
735735
*
736+
* NOTE: this property is a **hint**. It does not guarantee tool behavior.
737+
*
736738
* If not set, this is assumed to be true.
737739
*/
738-
openWorld?: boolean;
740+
openWorldHint?: boolean;
739741
}
740742

741743
/**
@@ -764,7 +766,7 @@ export interface Tool {
764766
};
765767

766768
/**
767-
* Annotations
769+
* Optional additional tool information.
768770
*/
769771
annotations?: ToolAnnotations;
770772
}
@@ -884,14 +886,14 @@ export interface SamplingMessage {
884886
export interface Annotations {
885887
/**
886888
* Describes who the intended customer of this object or data is.
887-
*
889+
*
888890
* It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`).
889891
*/
890892
audience?: Role[];
891893

892894
/**
893895
* Describes how important this data is for operating the server.
894-
*
896+
*
895897
* A value of 1 means "most important," and indicates that the data is
896898
* effectively required, while 0 means "least important," and indicates that
897899
* the data is entirely optional.
@@ -944,7 +946,6 @@ export interface ImageContent {
944946
annotations?: Annotations;
945947
}
946948

947-
948949
/**
949950
* Audio provided to or from an LLM.
950951
*/
@@ -969,7 +970,6 @@ export interface AudioContent {
969970
annotations?: Annotations;
970971
}
971972

972-
973973
/**
974974
* The server's preferences for model selection, requested of the client during sampling.
975975
*

0 commit comments

Comments
 (0)