fingerprintTools

Snapshot tool definitions so changes can be detected.

Hashes each tool's name, description, and schema into a fingerprint you can store. Pair it with detectToolDrift to notice when a remote server changes a tool after a user approved it.

let approved = fingerprintTools(try await mcp.tools())

Signature

func fingerprintTools(
    _ tools: [any AIToolProtocol]
) -> [String: MCPToolFingerprint]

Defined in Sources/AI/MCP/MCPToolDrift.swift.

Parameters

ParameterTypeDefault
_[any AIToolProtocol]required

Returns

A [String: MCPToolFingerprint] keyed by tool name.

See also