(result: Any)
| 119 | |
| 120 | |
| 121 | def loaded_paths(result: Any) -> list[str]: |
| 122 | paths: set[str] = set() |
| 123 | |
| 124 | for item in result.new_items: |
| 125 | if item.type != "tool_search_output_item": |
| 126 | continue |
| 127 | |
| 128 | raw_tools = ( |
| 129 | item.raw_item.get("tools") |
| 130 | if isinstance(item.raw_item, Mapping) |
| 131 | else getattr(item.raw_item, "tools", None) |
| 132 | ) |
| 133 | if not isinstance(raw_tools, list): |
| 134 | continue |
| 135 | |
| 136 | for raw_tool in raw_tools: |
| 137 | tool_payload = ( |
| 138 | raw_tool |
| 139 | if isinstance(raw_tool, Mapping) |
| 140 | else ( |
| 141 | raw_tool.model_dump(exclude_unset=True) |
| 142 | if callable(getattr(raw_tool, "model_dump", None)) |
| 143 | else None |
| 144 | ) |
| 145 | ) |
| 146 | if not isinstance(tool_payload, Mapping): |
| 147 | continue |
| 148 | |
| 149 | tool_type = tool_payload.get("type") |
| 150 | if tool_type == "namespace": |
| 151 | path = tool_payload.get("name") |
| 152 | elif tool_type == "function": |
| 153 | path = tool_payload.get("name") |
| 154 | else: |
| 155 | path = tool_payload.get("server_label") |
| 156 | |
| 157 | if isinstance(path, str) and path: |
| 158 | paths.add(path) |
| 159 | |
| 160 | return sorted(paths) |
| 161 | |
| 162 | |
| 163 | def print_result(title: str, result: Any, registered_paths: list[str]) -> None: |
no test coverage detected