Skip to content

Commit aeea758

Browse files
committed
docs: add table of annotations and pragmatic guidelines to README; remove unused entrySchema import from tools.ts in multiple exercises
1 parent d3a1e9e commit aeea758

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

exercises/01.advanced-tools/01.problem.annotations/src/tools.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
createEntryInputSchema,
66
createTagInputSchema,
77
entryIdSchema,
8-
entrySchema,
98
entryTagIdSchema,
109
tagIdSchema,
1110
updateEntryInputSchema,

exercises/01.advanced-tools/01.solution.annotations/src/tools.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
createEntryInputSchema,
66
createTagInputSchema,
77
entryIdSchema,
8-
entrySchema,
98
entryTagIdSchema,
109
tagIdSchema,
1110
updateEntryInputSchema,

exercises/01.advanced-tools/02.problem.structured/src/tools.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
createEntryInputSchema,
66
createTagInputSchema,
77
entryIdSchema,
8-
entrySchema,
98
entryTagIdSchema,
109
tagIdSchema,
1110
updateEntryInputSchema,

exercises/01.advanced-tools/README.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,33 @@ Here's a fun (and slightly dangerous) example of a tool that launches a real con
6262
the wrong time!
6363
</callout-warning>
6464

65+
### Table of Annotations
66+
67+
| Annotation | Default | Description | Relevance |
68+
| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
69+
| `readOnlyHint` | `false` | If true, the tool does not modify its environment. | Always relevant |
70+
| `destructiveHint` | `true` | If true, the tool may perform destructive updates to its environment. | Irrelevant when `readOnlyHint` is true |
71+
| `idempotentHint` | `false` | If true, calling the tool repeatedly with the same arguments will have no additional effect on its environment. | Irrelevant when `readOnlyHint` is true |
72+
| `openWorldHint` | `true` | If true, this tool may interact with an "open world" of external entities (outside of the tool's domain). | Always relevant |
73+
74+
### Pragmatic Annotation Guidelines
75+
76+
For practical tool design, consider these guidelines:
77+
78+
- Use `destructiveHint: true` for tools that **delete** records or data
79+
- Use `destructiveHint: false` for tools that **modify** content (even if original is overwritten).
80+
- Use `idempotentHint: true` for tools that produce the same logical result regardless of call count. Ignore metadata changes (timestamps, access logs, etc.). Focus on the core operation outcome.
81+
- Use `idempotentHint: false` for tools that produce a different result each time they are called.
82+
- Use `openWorldHint: true` for tools that interact with systems external to your application.
83+
84+
**Examples:**
85+
86+
- `delete_user(id: 123)` - **Destructive, Idempotent**
87+
- `update_user(id: 123, {name: "John"})` - **Non-destructive, Idempotent**
88+
- `increment_counter(id: 123)` - **Non-destructive, Not idempotent**
89+
90+
This approach prioritizes **practical usability** over theoretical precision because being pedantic about `updatedAt` timestamps makes annotations effectively meaningless.
91+
6592
### How Annotations Affect the Client
6693

6794
Clients can use annotations to:

0 commit comments

Comments
 (0)