Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ def get_description(self) -> str:
"Guides through structured code review and strategic planning."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only analysis tool."""
return {"readOnlyHint": True}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For a minor performance optimization and to establish a consistent pattern for constants, you could define the annotation dictionary as a class-level constant. This prevents creating a new dictionary every time get_annotations() is called. While the performance impact is likely small, this pattern can improve code clarity and is a good practice, especially if this method is called frequently.

This suggestion applies to all 14 tools modified in this PR.

Here's how you could implement it for AnalyzeTool:

class AnalyzeTool(WorkflowTool):
    _ANNOTATIONS = {"readOnlyHint": True}

    # ... other methods ...

    def get_annotations(self) -> Optional[dict[str, Any]]:
        """Return tool annotations indicating this is a read-only analysis tool."""
        return self._ANNOTATIONS


def get_system_prompt(self) -> str:
return ANALYZE_PROMPT

Expand Down
6 changes: 5 additions & 1 deletion tools/apilookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import json
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Optional

from pydantic import Field

Expand Down Expand Up @@ -79,6 +79,10 @@ def get_description(self) -> str:
"This tool searches authoritative sources (official docs, GitHub, package registries) to ensure up-to-date accuracy."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this searches external sources."""
return {"readOnlyHint": True, "openWorldHint": True}

def get_system_prompt(self) -> str:
return ""

Expand Down
4 changes: 4 additions & 0 deletions tools/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def get_description(self) -> str:
"Trigger automatically when a user critically questions, disagrees or appears to push back on earlier answers, and use it manually to sanity-check contentious claims."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only analysis tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
# Challenge tool doesn't need a system prompt since it doesn't call AI
return ""
Expand Down
4 changes: 4 additions & 0 deletions tools/codereview.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ def get_description(self) -> str:
"Guides through structured investigation to ensure thoroughness."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only code review tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
return CODEREVIEW_PROMPT

Expand Down
6 changes: 5 additions & 1 deletion tools/consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import json
import logging
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Optional

from pydantic import Field, model_validator

Expand Down Expand Up @@ -153,6 +153,10 @@ def get_description(self) -> str:
"Consults multiple models with different stances to synthesize comprehensive recommendations."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only consensus analysis tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
# For the CLI agent's initial analysis, use a neutral version of the consensus prompt
return CONSENSUS_PROMPT.replace(
Expand Down
4 changes: 4 additions & 0 deletions tools/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def get_description(self) -> str:
"Guides through structured investigation with hypothesis testing and expert analysis."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only debugging tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
return DEBUG_ISSUE_PROMPT

Expand Down
4 changes: 4 additions & 0 deletions tools/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def get_description(self) -> str:
"Analyzes code structure and patterns to create thorough documentation."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only documentation tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
return DOCGEN_PROMPT

Expand Down
6 changes: 5 additions & 1 deletion tools/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"""

import logging
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Optional

from pydantic import Field, field_validator

Expand Down Expand Up @@ -133,6 +133,10 @@ def get_description(self) -> str:
"Builds plans incrementally with deep reflection for complex scenarios."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only planning tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
return PLANNER_PROMPT

Expand Down
4 changes: 4 additions & 0 deletions tools/precommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ def get_description(self) -> str:
"Guides through structured investigation with expert analysis."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only validation tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
return PRECOMMIT_PROMPT

Expand Down
4 changes: 4 additions & 0 deletions tools/refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ def get_description(self) -> str:
"Guides through structured analysis with expert validation."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only refactoring analysis tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
return REFACTOR_PROMPT

Expand Down
4 changes: 4 additions & 0 deletions tools/secaudit.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ def get_description(self) -> str:
"Guides through structured security investigation with expert validation."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only security audit tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
"""Return the system prompt for expert security analysis."""
return SECAUDIT_PROMPT
Expand Down
4 changes: 4 additions & 0 deletions tools/testgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def get_description(self) -> str:
"Be specific about scope - target particular components rather than testing everything."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only test generation tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
return TESTGEN_PROMPT

Expand Down
4 changes: 4 additions & 0 deletions tools/thinkdeep.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ def get_description(self) -> str:
"""Return the tool description"""
return self.description

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only deep thinking tool."""
return {"readOnlyHint": True}

def get_model_category(self) -> "ToolModelCategory":
"""Return the model category for this tool"""
from tools.models import ToolModelCategory
Expand Down
4 changes: 4 additions & 0 deletions tools/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ def get_description(self) -> str:
"Supports precision mode (execution flow) and dependencies mode (structural relationships)."
)

def get_annotations(self) -> Optional[dict[str, Any]]:
"""Return tool annotations indicating this is a read-only code tracing tool."""
return {"readOnlyHint": True}

def get_system_prompt(self) -> str:
return TRACER_PROMPT

Expand Down
Loading