Skip to main content

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

Metadata

Release files for thingctx 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for thingctx 0.2.3
File Size Uploaded
thingctx-0.2.3.tar.gz 391.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for thingctx 0.2.3
File Interpreter ABI Platform
thingctx-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 662.4 kB

Release files / thingctx-0.2.3.tar.gz

Download URL thingctx-0.2.3.tar.gz
Size 391.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d15c345eb8c1aa7898f809e9ecb889aaeb52c1b48fa775e3e75a4c9e0e3a9b2a
BLAKE2b-256 checksum
How to use checksums
b49a9153f9b4e90185c4738e978dfb8f5db777643720eb090266091a67de1c69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release files / thingctx-0.2.3-py3-none-any.whl

Download URL thingctx-0.2.3-py3-none-any.whl
Size 270.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca3ddf59c4fa70eeadaa774e501f083ef4384c5911e7cbc7da8a05fd61dbc7e6
BLAKE2b-256 checksum
How to use checksums
fe3cd1304028bd38c06a7ee89637af7dde36cae6e44aaaa2a91cccc904909af8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page