Get tool metadata
(&self, name: &str)
| 198 | |
| 199 | /// Get tool metadata |
| 200 | pub fn get_tool_metadata(&self, name: &str) -> PyResult<Option<String>> { |
| 201 | let metadata = self.metadata.read().map_err(|e| { |
| 202 | PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!( |
| 203 | "Failed to acquire metadata lock: {}", |
| 204 | e |
| 205 | )) |
| 206 | })?; |
| 207 | |
| 208 | if let Some(meta) = metadata.get(name) { |
| 209 | let json = serde_json::to_string(meta).map_err(|e| { |
| 210 | PyErr::new::<pyo3::exceptions::PyValueError, _>(format!( |
| 211 | "Failed to serialize metadata: {}", |
| 212 | e |
| 213 | )) |
| 214 | })?; |
| 215 | Ok(Some(json)) |
| 216 | } else { |
| 217 | Ok(None) |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | /// Get all tools as LlmTool format for agent integration |
| 222 | pub fn get_llm_tools(&self) -> PyResult<Vec<String>> { |