Set read-only annotation hints on each tool for security
This commit is contained in:
@@ -100,6 +100,21 @@ class SimpleTool(BaseTool):
|
||||
"""
|
||||
return []
|
||||
|
||||
def get_annotations(self) -> Optional[dict[str, Any]]:
|
||||
"""
|
||||
Return tool annotations. Simple tools are read-only by default.
|
||||
|
||||
All simple tools perform operations without modifying the environment.
|
||||
They may call external AI models for analysis or conversation, but they
|
||||
don't write files or make system changes.
|
||||
|
||||
Override this method if your simple tool needs different annotations.
|
||||
|
||||
Returns:
|
||||
Dictionary with readOnlyHint set to True
|
||||
"""
|
||||
return {"readOnlyHint": True}
|
||||
|
||||
def format_response(self, response: str, request, model_info: Optional[dict] = None) -> str:
|
||||
"""
|
||||
Format the AI response before returning to the client.
|
||||
|
||||
Reference in New Issue
Block a user