Skip to main content

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

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

Built distribution (wheel)

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

Total release size: 71.9 kB

Release files / octools-1.2.0.tar.gz

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

Download URL octools-1.2.0-py3-none-any.whl
Size 37.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eeec6eba3f49a5bac99a7ab76617b1ab83b259dde72d9f6f84d7892820a2255a
BLAKE2b-256 checksum
How to use checksums
cd8c32bb109d83cd235ccef5cc42e10972d8668da36936e7e57bf89f0e74489c
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

This release

1.2.0 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