Files
zeekay 7a5968f9dc a pk- key authenticates nobody, so stop telling readers it reads
The README offered the two key shapes as a permission split — pk- to read,
sk- to write. cloud's own identity boundary says otherwise: middleware_identity
returns nil for any pk- before it consults the key store, because a key meant
for a browser bundle must not read. A pk- resolves to an org so a beacon can be
attributed to a tenant, and that is all it does.

Following the old sentence, a reader exports a pk- and every one of the five
flows answers 403 — /v1/tools spells out why, "a validated principal is
required" — and that refusal reads like a revoked key rather than the wrong
shape of key. examples/client.py now refuses a pk- before the request goes out,
the same argument that already rejects an unsendable access_token.

Also: three status codes in example docstrings had drifted from what the API
answers now (/v1/kv/keys/* 404s on every verb, /v1/automations/mcp 404s), and
two dead files went with them — examples/.keep, whose directory has held real
flows for a while, and scripts/mock, which reads a .stats.yml this repo does
not have and which scripts/test already says is unnecessary.
2026-08-14 14:45:57 -07:00

36 lines
1.2 KiB
Python

"""tools — list the tools this key can reach.
``GET /v1/tools`` (operationId ``get_tools``), the catalog behind the
MCP surface: each entry is a tool name, its description and its input schema.
A note on the MCP door, because it is easy to pick the wrong one. There is a
JSON-RPC endpoint at ``POST /v1/mcp`` that answers ``tools/list`` with the same
catalog — but it is NOT in the document, so the generator emits no method for it
and an example would have to bypass the SDK to call it, which defeats the point
of an SDK example. Of the MCP routes that ARE declared, ``/v1/automations/mcp``
404s at api.hanzo.ai. So this catalog read is the one that is both generated and
served. When ``/v1/mcp`` is added to the spec, this flow should move to it.
python -m examples.tools
"""
from hanzoai.cloud import ToolsApi
from examples.client import client, run
def main() -> None:
with client() as api:
catalog = ToolsApi(api).get_tools()
tools = catalog.tools or []
print(f"{len(tools)} tools")
for tool in tools[:20]:
print(f" {tool.name} — {tool.description or '(no description)'}")
if len(tools) > 20:
print(f" … and {len(tools) - 20} more")
if __name__ == "__main__":
run(main)