Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

octools

PyPI License: MIT

OpsCogs standard interface for AI agent tools: the OCTool descriptor, the result envelopes every tool returns, a conformance validator, and pure-dict converters to the MCP and Anthropic tool shapes. A library describes each capability once; any agent runtime registers it without re-expressing it by hand.

A TypeScript package, @opscogs/octools, implements the same contract.

Install

Python 3.12 or newer and pydantic 2.12 or newer (the only dependency).

pip install octools

Quick start

Describe the arguments and result as pydantic models, wrap the function in an OCTool, and list the tools from all_tools():

from pydantic import BaseModel, Field
from octools import (
    OCTool,
    RecordsEnvelope,
    input_schema_for,
    records_schema,
    to_mcp_tool,
)


class EchoArgs(BaseModel):
    values: list[str] = Field(description="Strings to echo back, one record each.")


class EchoRecord(BaseModel):
    value: str = Field(description="The echoed string.")
    position: int = Field(description="Zero-based position in the input.")


def echo_records(_dependency, *, values: list[str]) -> dict:
    records = [EchoRecord(value=v, position=i) for i, v in enumerate(values)]
    return RecordsEnvelope[EchoRecord](
        records=records, count=len(records), truncated=False
    ).model_dump(mode="json")


ECHO_RECORDS = OCTool(
    name="echo_records",
    description="Return each input string as one record with its position. Use it to check a tool round-trip. Returns a records envelope.",
    input_schema=input_schema_for(EchoArgs),
    output_schema=records_schema(EchoRecord),
    func=echo_records,
    access="local",
)


def all_tools() -> tuple[OCTool, ...]:
    return (ECHO_RECORDS,)


mcp_entry = to_mcp_tool(ECHO_RECORDS)

In your test suite, assert validate_provider(my_tools) == [] lists every conformance finding. List a provider from the command line with octools list my_tools; octools list octools.example lists the built-in demo provider.

License

MIT. See LICENSE. The OpsCogs name and logos are not covered by that license; see NOTICE.

Metadata

Release files for octools 1.2.0rc1

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

Source distribution (sdist)

Source distribution for octools 1.2.0rc1
File Size Uploaded
octools-1.2.0rc1.tar.gz 34.0 kB Details

Built distribution (wheel)

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

Total release size: 72.0 kB

Release files / octools-1.2.0rc1.tar.gz

Download URL octools-1.2.0rc1.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1bfd4afc870663dfe58ba02c2204e6fbe2875017f6e1cc64742e58c889e73a23
BLAKE2b-256 checksum
How to use checksums
bdfb66e438168eda64c84e52e998052ad424ba0c2eda4abb8aa5b456e26f193a
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 Oct 8, 2026.

Transparency log

Release files / octools-1.2.0rc1-py3-none-any.whl

Download URL octools-1.2.0rc1-py3-none-any.whl
Size 38.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aae8717ab379bcf9566ad55b9e1688dcc913b12d896bd9ec96b696e71491b36d
BLAKE2b-256 checksum
How to use checksums
455d6edd5cd620025822927bfbdd60cd666fdbc2e78f289218d3cc6948c76f5a
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 Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

1.2.0

2 release files

This release

1.2.0rc1 This release

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