@gram-ai/create-function 0.12.3 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -59,8 +59,47 @@ Each tool requires:
|
|
|
59
59
|
- **name**: A unique identifier for the tool
|
|
60
60
|
- **description** (optional): Human-readable description of what the tool does
|
|
61
61
|
- **inputSchema**: A Zod schema object defining the expected input parameters
|
|
62
|
+
- **annotations** (optional): Behavior hints for AI models (see below)
|
|
62
63
|
- **execute**: An async function that implements the tool logic
|
|
63
64
|
|
|
65
|
+
### Tool Annotations
|
|
66
|
+
|
|
67
|
+
Annotations are optional hints that describe tool behavior to AI models and
|
|
68
|
+
clients. They align with the
|
|
69
|
+
[MCP tool annotations spec](https://modelcontextprotocol.io/docs/concepts/tools#tool-annotations).
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
.tool({
|
|
73
|
+
name: "delete_user",
|
|
74
|
+
description: "Permanently delete a user account",
|
|
75
|
+
inputSchema: { userId: z.string() },
|
|
76
|
+
annotations: {
|
|
77
|
+
title: "Delete User",
|
|
78
|
+
destructiveHint: true,
|
|
79
|
+
readOnlyHint: false,
|
|
80
|
+
idempotentHint: true,
|
|
81
|
+
openWorldHint: false,
|
|
82
|
+
},
|
|
83
|
+
async execute(ctx, input) {
|
|
84
|
+
await deleteUser(input.userId);
|
|
85
|
+
return ctx.json({ deleted: true });
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Available annotation fields:
|
|
91
|
+
|
|
92
|
+
| Field | Type | Default | Description |
|
|
93
|
+
| ------------------ | --------- | ------- | ----------------------------------------------- |
|
|
94
|
+
| `title` | `string` | — | Human-readable display name for the tool |
|
|
95
|
+
| `readOnlyHint` | `boolean` | `false` | Tool does not modify its environment |
|
|
96
|
+
| `destructiveHint` | `boolean` | `true` | Tool may perform destructive updates |
|
|
97
|
+
| `idempotentHint` | `boolean` | `false` | Repeated calls with same args have no extra effect |
|
|
98
|
+
| `openWorldHint` | `boolean` | `true` | Tool interacts with external entities |
|
|
99
|
+
|
|
100
|
+
All annotation properties are **hints** — they are not guaranteed to be
|
|
101
|
+
accurate and clients should not rely on them for security decisions.
|
|
102
|
+
|
|
64
103
|
### Tool Context
|
|
65
104
|
|
|
66
105
|
The `execute` function receives a `ctx` (context) object with helper methods:
|
|
@@ -343,6 +382,7 @@ const manifest = g.manifest();
|
|
|
343
382
|
// name: "tool1",
|
|
344
383
|
// description: "...",
|
|
345
384
|
// inputSchema: "...", // JSON Schema string
|
|
385
|
+
// annotations: { title: "...", readOnlyHint: true, ... },
|
|
346
386
|
// variables: { ... }
|
|
347
387
|
// },
|
|
348
388
|
// ...
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@gram-ai/create-function",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.4",
|
|
5
5
|
"description": "Build AI tools and deploy them to getgram.ai",
|
|
6
6
|
"keywords": [],
|
|
7
7
|
"homepage": "https://github.com/speakeasy-api/gram",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"prettier": "^3.6.2",
|
|
39
39
|
"typescript": "5.9.3",
|
|
40
40
|
"zod": "^3.25.76",
|
|
41
|
-
"@gram-ai/functions": "^0.12.
|
|
41
|
+
"@gram-ai/functions": "^0.12.4"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc --noEmit false"
|