thingctx
thingctx is a Python library that turns a W3C Web of Things Thing Description into tools an AI agent can call. The description is a JSON document naming a system's actions and a transport for each; thingctx runs every call over that transport. No server per integration.
You can add a policy gate that decides each call before any transport runs: allow reads, deny writes, or ask a human first. The binding holds the credential; the model never sees it.
First run
pip install thingctx
The base install pulls no dependencies. This runs with no keys and no network:
import asyncio
import thingctx
from thingctx.contrib.time import make_time_handler
td = {
"@context": "https://www.w3.org/2022/wot/td/v1.1",
"id": "urn:demo:clock",
"title": "Clock",
"securityDefinitions": {"nosec_sc": {"scheme": "nosec"}},
"security": ["nosec_sc"],
"actions": {
"getCurrentTime": {
"input": {
"type": "object",
"properties": {"timezone": {"type": "string"}},
},
"forms": [{"href": "local://getCurrentTime"}],
}
},
}
async def main():
client = thingctx.ThingClient(
tds=[td], bindings=[thingctx.LocalBinding(make_time_handler())]
)
tools, invoke = client.as_tools()
print("tools:", [t["function"]["name"] for t in tools])
print(await invoke("clock__getCurrentTime", {"timezone": "UTC"}))
asyncio.run(main())
Agent loop
Install 'thingctx[llm,http]', set your provider key, import thingctx, and
inside an async function:
host = await thingctx.from_url("https://example.com/device.td.json")
print(await host.chat("summarize the device's status"))
from_url accepts any URL that serves a Thing Description.
Closed agent (Claude Desktop, VS Code)? Install 'thingctx[mcp]' and bridge a
folder of descriptions:
thingctx-mcp ./registry/
Docs and source
Full README, examples, and design notes: https://github.com/thingctx/thingctx
Apache-2.0
mcp-name: com.thingctx/thingctx
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file thingctx-0.2.2.tar.gz.
File metadata
- Download URL: thingctx-0.2.2.tar.gz
- Upload date:
- Size: 380.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bbcf391c153d76a229cfc52b529d8d74e92d4d9d0a7cedf346e3ae310c149c8
|
|
| MD5 |
97691fd8f757ae7fbbfe65c5f5d1c273
|
|
| BLAKE2b-256 |
606efefe116c03480f89b4c02ff0e0cfe7dfa84c18a2020d8ee50f3c82aa3d31
|
Provenance
The following attestation bundles were made for thingctx-0.2.2.tar.gz:
Publisher:
release.yml on thingctx/thingctx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thingctx-0.2.2.tar.gz -
Subject digest:
6bbcf391c153d76a229cfc52b529d8d74e92d4d9d0a7cedf346e3ae310c149c8 - Sigstore transparency entry: 2256663546
- Sigstore integration time:
-
Permalink:
thingctx/thingctx@8d6c928e080d4cc04082587dce7d89976762ba00 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/thingctx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8d6c928e080d4cc04082587dce7d89976762ba00 -
Trigger Event:
push
-
Statement type:
File details
Details for the file thingctx-0.2.2-py3-none-any.whl.
File metadata
- Download URL: thingctx-0.2.2-py3-none-any.whl
- Upload date:
- Size: 264.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59c0f44a8f755e4690a580e3f4ee84cd8e9ad54a486c5bb21d49a81c2df08ecc
|
|
| MD5 |
1733dfaab837843cbeaebd4b1b84784b
|
|
| BLAKE2b-256 |
339afae9c03c6c693c5bd6b7a641bad9c93bc371b49d55adad2dd09ff8cdeaa3
|
Provenance
The following attestation bundles were made for thingctx-0.2.2-py3-none-any.whl:
Publisher:
release.yml on thingctx/thingctx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thingctx-0.2.2-py3-none-any.whl -
Subject digest:
59c0f44a8f755e4690a580e3f4ee84cd8e9ad54a486c5bb21d49a81c2df08ecc - Sigstore transparency entry: 2256663556
- Sigstore integration time:
-
Permalink:
thingctx/thingctx@8d6c928e080d4cc04082587dce7d89976762ba00 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/thingctx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8d6c928e080d4cc04082587dce7d89976762ba00 -
Trigger Event:
push
-
Statement type: