Skip to main content

Core driver contract for the Model Context Standard.

Project description

mcs-driver-core

Core driver contract for the Model Context Standard (MCS).

This package defines the language-agnostic MCSDriver and MCSToolDriver interfaces, metadata classes (DriverMeta, DriverBinding, DriverResponse), extraction strategies, prompt strategies, and optional mixins (ToolCallSignaling, SupportsNativeTools).

It has zero runtime dependencies and weighs only a few kilobytes.

Installation

pip install mcs-driver-core

Quick start

from mcs.driver.core import MCSDriver, DriverMeta, DriverResponse

class MyDriver(MCSDriver):
    ...

Capability detection

Optional features (health checks, native tool-calling via get_native_tool_context, streaming tool-call signaling, …) are advertised as flags in DriverMeta.capabilities. Each optional contract carries its flag as a CAPABILITY constant. There are two operations — detection ("is the feature there?") and invocation ("give me the object that provides it") — and both avoid isinstance:

from mcs.driver.core import DriverMeta, SupportsNativeTools

# detection: a pure read over the (aggregated) capability flags
if driver.meta.has_capability(SupportsNativeTools):
    ...

# invocation: get the layer that satisfies the contract -- typed, no cast,
# works whether `driver` is a plain driver, an orchestrator, or a decorator
if (dc := DriverMeta.resolve_capability(driver, SupportsNativeTools)):
    ctx = dc.get_native_tool_context(model)

Do not rely on isinstance for feature detection. Drivers are composable: a decorator (auth, permission, hooks, …) wraps another driver, satisfies the same MCSDriver / MCSToolDriver interfaces, and is injected via dependency injection — so from the outside it just looks like a driver, and the client cannot know what the stack contains. isinstance only sees the outermost layer and misses capabilities provided deeper in the stack. Each decorator aggregates the inner driver's capabilities and adds its own, so meta.capabilities reflects the whole stack; isinstance does not.

What lives in core — and what doesn't

mcs-driver-core holds the contracts (MCSDriver, MCSToolDriver, DriverMeta) plus the reference implementations that are pure composition mechanism — and nothing more:

  • BaseDriver — the leaf. A ready-made implementation of the mandatory driver methods (prompt generation, response parsing). It carries no resolution logic of its own: a leaf has no inner layers, so the resolution entry point's isinstance fallback matches it directly.
  • BaseDecorator — the transparent wrapping node. It delegates every interface call to a single inner driver and resolves capabilities by searching inward, so an inner capability stays reachable through the decorator. Being nothing but delegation plus stack-navigation, it belongs here alongside BaseDriver.

Both are zero-dependency and carry no concept of their own; they are the minimal machinery the contract already implies.

The orchestrator lives in its own package (mcs-orchestrator-base), even though it is also a wrapping driver. The difference is decisive: it brings an abstraction of its own — a pluggable ResolutionStrategy (tool pipelines, namespacing, tool-switching layers). That is a strategy family with a concept of its own, not bare mechanism, so it earns a package of its own (and keeps the kernel free of that weight).

Rule of thumb: pure composition mechanism — the leaf and the wrapping delegation — lives in the kernel; composition that carries its own strategy becomes its own package.

Links

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcs_driver_core-0.4.1.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcs_driver_core-0.4.1-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file mcs_driver_core-0.4.1.tar.gz.

File metadata

  • Download URL: mcs_driver_core-0.4.1.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mcs_driver_core-0.4.1.tar.gz
Algorithm Hash digest
SHA256 465c06c0de9e0d4f257b0f40a09ad59a531204b5a9e783966631a76da7428300
MD5 bd8fee174190135f56274fbee45599ad
BLAKE2b-256 ac4b7b930d999f737ab60d2c1948ac9a81fca3b4be3dcfba308dec4e0e094e26

See more details on using hashes here.

File details

Details for the file mcs_driver_core-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mcs_driver_core-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c7278c46f3d2d21d6045d616aec7cbb4ce245b2243e679f6ed837fc660a69759
MD5 6ce1b1db7941da1f12a016ac3acfb8bf
BLAKE2b-256 01e27ac40b798bc10d7f3c1e02e34907afa522595193d885f072ae0516340746

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page