Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions docs/docs/concepts/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Each tool is defined with the following structure:
destructiveHint?: boolean; // If true, the tool may perform destructive updates
idempotentHint?: boolean; // If true, repeated calls with same args have no additional effect
openWorldHint?: boolean; // If true, tool interacts with external entities
statelessHint?: boolean; // If true, tool does not maintain state from previous requests
streamingHint?: boolean; // If true, tool streams its responses
asyncHint?: boolean; // If true, tool works asynchronously to generate responses
}
}
```
Expand Down Expand Up @@ -333,6 +336,9 @@ The MCP specification defines the following annotations for tools:
| `destructiveHint` | boolean | true | If true, the tool may perform destructive updates (only meaningful when `readOnlyHint` is false) |
| `idempotentHint` | boolean | false | If true, calling the tool repeatedly with the same arguments has no additional effect (only meaningful when `readOnlyHint` is false) |
| `openWorldHint` | boolean | true | If true, the tool may interact with an "open world" of external entities |
| `statelessHint` | boolean | false | If true, this tool does not maintain state based on previous requests |
| `streamingHint` | boolean | false | If true, this tool may stream its responses |
| `asyncHint` | boolean | false | If true, this tool accepts a request and continues to work asynchronously to generate responses |

### Example usage

Expand All @@ -353,7 +359,9 @@ Here's how to define tools with annotations for different scenarios:
annotations: {
title: "Web Search",
readOnlyHint: true,
openWorldHint: true
openWorldHint: true,
streamingHint: false,
asyncHint: false
}
}

Expand All @@ -373,7 +381,9 @@ Here's how to define tools with annotations for different scenarios:
readOnlyHint: false,
destructiveHint: true,
idempotentHint: true,
openWorldHint: false
openWorldHint: false,
statelessHint: true,
streamingHint: false,
}
}

Expand All @@ -394,7 +404,32 @@ Here's how to define tools with annotations for different scenarios:
readOnlyHint: false,
destructiveHint: false,
idempotentHint: false,
openWorldHint: false
openWorldHint: false,
statelessHint: true,
}
}

// An asynchronous timeseries forecasting tool
{
name: "create_timeseries_forecast",
description: "Create a forecast for timeseries data",
inputSchema: {
type: "object",
properties: {
timeseries: { type: "object" },
forecast_horizon: { type: "number" }
},
required: ["timeseries", "forecast_horizon"]
},
annotations: {
title: "Create Timeseries Forecast",
readOnlyHint: false,
destructiveHint: false,
idempotentHint: true,
openWorldHint: false,
statelessHint: true,
streamingHint: false,
asyncHint: true,
}
}
```
Expand Down
12 changes: 12 additions & 0 deletions schema/draft/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,10 @@
"ToolAnnotations": {
"description": "Additional properties describing a Tool to clients.\n\nNOTE: all properties in ToolAnnotations are **hints**.\nThey are not guaranteed to provide a faithful description of\ntool behavior (including descriptive properties like `title`).\n\nClients should never make tool use decisions based on ToolAnnotations\nreceived from untrusted servers.",
"properties": {
"asyncHint": {
"description": "If true, this tool accepts a request and continues to work\nasynchronously to generate responses.\n\nDefault: false",
"type": "boolean"
},
"destructiveHint": {
"description": "If true, the tool may perform destructive updates to its environment.\nIf false, the tool performs only additive updates.\n\n(This property is meaningful only when `readOnlyHint == false`)\n\nDefault: true",
"type": "boolean"
Expand All @@ -2331,6 +2335,14 @@
"description": "If true, the tool does not modify its environment.\n\nDefault: false",
"type": "boolean"
},
"statelessHint": {
"description": "If true, this tool does not maintain state based on previous requests.\nIf false, the tool may maintain state based on previous interactions\nand the context from the previous requests might influence the next\nresponse.\n\nDefault: false",
"type": "boolean"
},
"streamingHint": {
"description": "If true, this tool streams its responses.\n\nDefault: false",
"type": "boolean"
},
"title": {
"description": "A human-readable title for the tool.",
"type": "string"
Expand Down
25 changes: 25 additions & 0 deletions schema/draft/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,31 @@ export interface ToolAnnotations {
* Default: true
*/
openWorldHint?: boolean;

/**
* If true, this tool does not maintain state based on previous requests.
* If false, the tool may maintain state based on previous interactions
* and the context from the previous requests might influence the next
* response.
*
* Default: false
*/
statelessHint?: boolean;

/**
* If true, this tool streams its responses.
*
* Default: false
*/
streamingHint?: boolean;

/**
* If true, this tool accepts a request and continues to work
* asynchronously to generate responses.
*
* Default: false
*/
asyncHint?: boolean;
}

/**
Expand Down