Skip to content
Open
Changes from all commits
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
32 changes: 32 additions & 0 deletions src/lightspeed_agent/tools/integrity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Lightweight data integrity verification for MCP tool results."""

import hashlib
import logging

logger = logging.getLogger(__name__)


def log_response_fingerprint(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is never imported, nor used. The whole file looks like dead code

tool_name: str,
result: str,
request_id: str = "",
) -> str:
"""Log a SHA-256 fingerprint of an MCP tool result for forensic tracing.

Args:
tool_name: Name of the MCP tool that produced the result.
result: The raw result string.
request_id: Optional request ID for correlation.

Returns:
The hex digest fingerprint.
"""
fingerprint = hashlib.sha256(result.encode("utf-8")).hexdigest()[:16]
logger.info(
"MCP result fingerprint: tool=%s request_id=%s fingerprint=%s length=%d",
tool_name,
request_id,
fingerprint,
len(result),
)
return fingerprint
Loading