You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(intent): infer operation_type from tool variant instead of requiring it (#282)
* fix(intent): infer operation_type from tool variant instead of requiring it
This fixes#278 where Gemini 3 Pro via Antigravity crashed when
generating tool calls with nested JSON objects in the intent parameter.
Changes:
- Remove operation_type requirement from intent parameter
- Infer operation_type automatically from tool variant:
- call_tool_read → "read"
- call_tool_write → "write"
- call_tool_destructive → "destructive"
- Make intent parameter optional (empty {} now works)
- Update validateIntentForVariant to return (intent, error) and create
default intent if nil
- Simplify Validate() to only check optional fields (data_sensitivity,
reason)
- Update tests to reflect new behavior
- Update documentation
The two-key security model was redundant - the tool variant already
declares intent. This simplification enables compatibility with models
that have issues generating nested JSON objects.
Closes#278
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(intent): remove intent object from schema for Gemini compatibility
Gemini 3 Pro has strict limitations with nested objects in tool schemas:
- Maximum 4-level nesting depth
- Cannot handle untyped/schema-less objects
- Strict schema validation
Remove the `intent` object parameter entirely from call_tool_* schemas.
The operation_type is already inferred from the tool variant, and the
optional audit fields (data_sensitivity, reason) can be added back later
if needed via flat string parameters.
This should resolve the "improper format stop reason" errors when Gemini
tries to generate tool calls.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor(intent): flatten intent params for Gemini 3 Pro compatibility
Replace nested intent object with flat string parameters to avoid
Gemini 3 Pro's strict limitations with nested JSON objects:
- Replace `intent: { data_sensitivity, reason }` with flat params:
- `intent_data_sensitivity` - optional data classification
- `intent_reason` - optional explanation for audit trail
- Update extractIntent() to read from flat parameters
- operation_type still inferred from tool variant (call_tool_read/write/destructive)
- Activity log features preserved - intent metadata recorded in activity records
- Update tests and documentation
Fixes#278
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(cli): use flat intent params in call commands
The CLI was still building a nested intent object which the
server's extractIntent() no longer reads. Updated to use flat
intent_data_sensitivity and intent_reason parameters.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs(intent): improve intent param descriptions to encourage usage
- Remove "Optional" from descriptions (models skip optional fields)
- Change "For audit trail" to "Recommended for compliance/accountability"
- Add "Requires intent.operation_type" to main tool descriptions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(intent): improve descriptions to encourage LLMs to provide intent fields
- Remove operation_type mentions (inferred from tool name)
- Make intent_data_sensitivity action-oriented: "Classify data being accessed/modified/deleted"
- Make intent_reason a question with examples: "Why is this tool being called?"
- Update retrieve_tools: "Always provide intent_reason and intent_data_sensitivity"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(lint): remove unused isValidOperationType function
No longer needed since operation_type is inferred from tool variant.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
**Intent Declaration (Spec 018)**: Tool variants enable granular IDE permission control. The `intent` parameter provides two-key security:
176
+
**Intent Declaration (Spec 018)**: Tool variants enable granular IDE permission control. The `operation_type` is automatically inferred from the tool variant (`call_tool_read` → "read", etc.). Optional `intent` fields for audit:
Copy file name to clipboardExpand all lines: docs/features/intent-declaration.md
+49-62Lines changed: 49 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,58 +42,54 @@ MCPProxy Tools:
42
42
[ ] call_tool_destructive → Always ask + confirm
43
43
```
44
44
45
-
## Two-Key Security Model
45
+
## How It Works
46
46
47
-
Agents must declare intent in **two places** that must match:
48
-
49
-
1.**Tool Selection**: Which variant to call (`call_tool_read` / `write` / `destructive`)
50
-
2.**Intent Parameter**: `intent.operation_type` must match the tool variant
47
+
The tool variant (`call_tool_read` / `write` / `destructive`) **automatically determines** the operation type. Intent metadata is provided as **flat string parameters** (not nested objects) for maximum compatibility with AI models:
Intent mismatch: tool is call_tool_read but intent declares write.
290
-
Use call_tool_write for write operations.
291
-
```
292
-
293
277
**Server annotation conflict:**
294
278
```
295
279
Tool 'github:delete_repo' is marked destructive by server.
296
280
Use call_tool_destructive instead of call_tool_read.
297
281
```
298
282
299
-
**Missing intent:**
283
+
**Invalid data sensitivity:**
300
284
```
301
-
intent.operation_type is required.
302
-
Provide intent: {operation_type: "read"|"write"|"destructive"}
285
+
Invalid intent.data_sensitivity 'secret': must be public, internal, private, or unknown
286
+
```
287
+
288
+
**Reason too long:**
289
+
```
290
+
intent.reason exceeds maximum length of 1000 characters
303
291
```
304
292
305
293
## IDE Configuration Examples
@@ -362,14 +350,13 @@ The legacy `call_tool` has been removed. Update your integrations:
362
350
"name": "call_tool_write",
363
351
"arguments": {
364
352
"name": "github:create_issue",
365
-
"args_json": "{...}",
366
-
"intent": {
367
-
"operation_type": "write"
368
-
}
353
+
"args_json": "{...}"
369
354
}
370
355
}
371
356
```
372
357
358
+
Intent parameters are optional - `operation_type` is automatically inferred from the tool variant. You can add `intent_data_sensitivity` and `intent_reason` for audit purposes.
359
+
373
360
:::tip Choosing the Right Variant
374
361
When unsure, use `call_tool_destructive` - it's the most permissive and will always succeed validation. Then refine based on `retrieve_tools` guidance.
0 commit comments