-
Notifications
You must be signed in to change notification settings - Fork 800
Open
Description
Question
Is there a way to create tools where the annotations field is only included in JSON output when annotations are explicitly provided?
Current Behavior
NewTool() initializes annotations with defaults, and MarshalJSON() always includes them:
{
"name": "my_tool",
"inputSchema": {...},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true
}
}Desired Behavior
For tools where I don't have annotation metadata, I'd like to omit the field entirely:
{
"name": "my_tool",
"inputSchema": {...}
}This would let clients distinguish between "explicitly annotated" vs "no annotation data available."
Potential Approaches
- A new option like
WithoutDefaultAnnotations() - Conditional serialization in
MarshalJSON()when all fields are nil/empty
Happy to implement if there's interest. What approach would fit best?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels