MCPcopy Create free account
hub / github.com/OpenOSINT/OpenOSINT / format_tool_result

Function format_tool_result

openosint/json_output.py:14–40  ·  view source on GitHub ↗

Build a structured dict representing one tool's output. Schema ------ { "tool": str, # tool name "target": str, # target passed to the tool "timestamp": str, # ISO-8601 UTC timestamp "results": list[str], # non-empty o

(
    tool: str,
    target: str,
    result: str,
    error: str | None = None,
)

Source from the content-addressed store, hash-verified

12
13
14def format_tool_result(
15 tool: str,
16 target: str,
17 result: str,
18 error: str | None = None,
19) -> dict:
20 """
21 Build a structured dict representing one tool's output.
22
23 Schema
24 ------
25 {
26 "tool": str, # tool name
27 "target": str, # target passed to the tool
28 "timestamp": str, # ISO-8601 UTC timestamp
29 "results": list[str], # non-empty output lines
30 "error": str | null # error message if the call failed
31 }
32 """
33 lines = [ln for ln in result.splitlines() if ln.strip()] if result else []
34 return {
35 "tool": tool,
36 "target": target,
37 "timestamp": datetime.now(timezone.utc).isoformat(),
38 "results": lines,
39 "error": error,
40 }
41
42
43def to_json(

Callers 15

_handle_emailFunction · 0.90
_handle_usernameFunction · 0.90
_handle_shodanFunction · 0.90
_handle_virustotalFunction · 0.90
_handle_censysFunction · 0.90
_handle_abuseipdbFunction · 0.90
_handle_githubFunction · 0.90
_handle_dnsFunction · 0.90
_handle_ip2locationFunction · 0.90
test_target_preservedMethod · 0.90

Calls

no outgoing calls