Set read-only annotation hints on each tool for security
This commit is contained in:
@@ -43,11 +43,11 @@ class ListModelsTool(BaseTool):
|
||||
|
||||
def get_input_schema(self) -> dict[str, Any]:
|
||||
"""Return the JSON schema for the tool's input"""
|
||||
return {
|
||||
"type": "object",
|
||||
"properties": {"model": {"type": "string", "description": "Model to use (ignored by listmodels tool)"}},
|
||||
"required": [],
|
||||
}
|
||||
return {"type": "object", "properties": {}, "required": []}
|
||||
|
||||
def get_annotations(self) -> Optional[dict[str, Any]]:
|
||||
"""Return tool annotations indicating this is a read-only tool"""
|
||||
return {"readOnlyHint": True}
|
||||
|
||||
def get_system_prompt(self) -> str:
|
||||
"""No AI model needed for this tool"""
|
||||
@@ -57,6 +57,9 @@ class ListModelsTool(BaseTool):
|
||||
"""Return the Pydantic model for request validation."""
|
||||
return ToolRequest
|
||||
|
||||
def requires_model(self) -> bool:
|
||||
return False
|
||||
|
||||
async def prepare_prompt(self, request: ToolRequest) -> str:
|
||||
"""Not used for this utility tool"""
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user