Tool for recalling recorded session notes.
| 126 | |
| 127 | |
| 128 | class RecallNoteTool(Tool): |
| 129 | """Tool for recalling recorded session notes.""" |
| 130 | |
| 131 | def __init__(self, memory_file: str = "./workspace/.agent_memory.json"): |
| 132 | """Initialize recall note tool. |
| 133 | |
| 134 | Args: |
| 135 | memory_file: Path to the note storage file |
| 136 | """ |
| 137 | self.memory_file = Path(memory_file) |
| 138 | |
| 139 | @property |
| 140 | def name(self) -> str: |
| 141 | return "recall_notes" |
| 142 | |
| 143 | @property |
| 144 | def description(self) -> str: |
| 145 | return ( |
| 146 | "Recall all previously recorded session notes. " |
| 147 | "Use this to retrieve important information, context, or decisions " |
| 148 | "from earlier in the session or previous agent execution chains." |
| 149 | ) |
| 150 | |
| 151 | @property |
| 152 | def parameters(self) -> dict[str, Any]: |
| 153 | return { |
| 154 | "type": "object", |
| 155 | "properties": { |
| 156 | "category": { |
| 157 | "type": "string", |
| 158 | "description": "Optional: filter notes by category", |
| 159 | }, |
| 160 | }, |
| 161 | } |
| 162 | |
| 163 | async def execute(self, category: str = None) -> ToolResult: |
| 164 | """Recall session notes. |
| 165 | |
| 166 | Args: |
| 167 | category: Optional category filter |
| 168 | |
| 169 | Returns: |
| 170 | ToolResult with notes content |
| 171 | """ |
| 172 | try: |
| 173 | if not self.memory_file.exists(): |
| 174 | return ToolResult( |
| 175 | success=True, |
| 176 | content="No notes recorded yet.", |
| 177 | ) |
| 178 | |
| 179 | notes = json.loads(self.memory_file.read_text()) |
| 180 | |
| 181 | if not notes: |
| 182 | return ToolResult( |
| 183 | success=True, |
| 184 | content="No notes recorded yet.", |
| 185 | ) |
no outgoing calls