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.0rc2

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.0rc2
File Size Uploaded
octools-1.2.0rc2.tar.gz 34.0 kB Details

Built distribution (wheel)

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

Total release size: 72.0 kB

Release files / octools-1.2.0rc2.tar.gz

Download URL octools-1.2.0rc2.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b470feae200c35a9e41b324c115052e674fa54d19cfb95d3433d5ba07ae6c683
BLAKE2b-256 checksum
How to use checksums
7825ee3e8954609fddab3b71e8ddea1830aca2e29035a2209e464228d576d74b
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.0rc2-py3-none-any.whl

Download URL octools-1.2.0rc2-py3-none-any.whl
Size 38.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0714eb98d6762e0209589eded0f21e1bcd3678c520afa1cafd65ec5763920323
BLAKE2b-256 checksum
How to use checksums
4f48c9904c8211b5b6a53750f296429a1b4e35166273c5d3235347b41331866b
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.0rc2 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