kdeps-tools-md5_file
v2.0.0Compute the MD5 checksum of a file. Call once before and once after a change to prove whether the file's contents actually changed -- pair both hashes as evidence rather than asserting the change happened.
set tools / shelf tools
LLM context: ~110 tokens when loaded (prompt or tool definition)
Where it runs
Part of the tools set, used in workflow and agent mode. What the model is told about each built-in tool: its description, usage notes and parameters. kdeps runs the tool itself.
- the agent loop builds the request
- the tool definitions are sent to the modeltools/md5_file
- the model calls a tool
- kdeps runs it
- the result goes back to the model
Loaded by: kdeps (agent loop), /update, /settings, kdeps run, kdeps install, kdeps list, kdeps uninstall, kdeps update
In the code: kdeps (agent loop)agent.RegisterBuiltinToolsagent.definedAs
Install
A kdeps asset: installed with the first-run profile that includes its set, or the first time a command needs it, and updated without a new release.
Pin a version with kdeps install tools/md5_file@<version>.
Contents
Compute the MD5 checksum of a file. Call once before and once after a change to prove whether the file's contents actually changed -- pair both hashes as evidence rather than asserting the change happened.
- category
- file
- outputFormat
- the absolute path, two spaces, then the hex digest
- seeAlso
- read_file, tail_file, list_files
| Parameter | Type | Description |
|---|---|---|
| file_path * | string | Path to the file to hash (absolute, or relative to the working directory) |
Python script (declared in YAML, no Go code)
import hashlib, json, os, sys
path = json.loads(sys.argv[1])["file_path"]
# An absolute path comes back as given; a relative one is resolved.
path = path if os.path.isabs(path) else os.path.abspath(path)
if os.path.isdir(path):
sys.exit("md5_file: %s is a directory" % path)
h = hashlib.md5()
try:
with open(path, "rb") as f:
for chunk in iter(lambda: f.read(1 << 20), b""):
h.update(chunk)
except OSError as e:
sys.exit("md5_file: %s: %s" % (path, e.strerror or e))
print("%s %s" % (path, h.hexdigest()))
Paths kept in the workspace: file_path
version: 2.0.0
category: file
description: Compute the MD5 checksum of a file. Call once before and once after a change to prove whether the file's contents actually changed -- pair both hashes as evidence rather than asserting the change happened.
outputFormat: the absolute path, two spaces, then the hex digest
seeAlso: read_file, tail_file, list_files
parameters:
file_path:
type: string
description: Path to the file to hash (absolute, or relative to the working directory)
required: true
python:
paths: [file_path] # checked against the workspace boundary
script: |
import hashlib, json, os, sys
path = json.loads(sys.argv[1])["file_path"]
# An absolute path comes back as given; a relative one is resolved.
path = path if os.path.isabs(path) else os.path.abspath(path)
if os.path.isdir(path):
sys.exit("md5_file: %s is a directory" % path)
h = hashlib.md5()
try:
with open(path, "rb") as f:
for chunk in iter(lambda: f.read(1 << 20), b""):
h.update(chunk)
except OSError as e:
sys.exit("md5_file: %s: %s" % (path, e.strerror or e))
print("%s %s" % (path, h.hexdigest()))
Versions
| Version | Published | Status |
|---|---|---|
| 2.0.0 | 10/24/2026 | active |
| 1.0.1 | 10/23/2026 | active |
| 1.0.0 | 10/11/2026 | active |
Details
- Author
- kdeps
- License
- Apache-2.0
- Latest Version
- 2.0.0
- Published
- 10/11/2026