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.
Links
- Homepage: https://www.modelcontextstandard.io
- Source: https://github.com/modelcontextstandard/python-sdk
- Specification: https://modelcontextstandard.io/Specification
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcs_driver_core-0.3.0.tar.gz.
File metadata
- Download URL: mcs_driver_core-0.3.0.tar.gz
- Upload date:
- Size: 29.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22e7337213048ef9a7a26e30fa35dbd2d6d0b012226334868864f549498daab3
|
|
| MD5 |
374912eed3b67439f2ba4df4e5d5807e
|
|
| BLAKE2b-256 |
7bfa5e1dba996380d16ae9a77597c685a766387774c68d34fc936b7d4ca5002d
|
File details
Details for the file mcs_driver_core-0.3.0-py3-none-any.whl.
File metadata
- Download URL: mcs_driver_core-0.3.0-py3-none-any.whl
- Upload date:
- Size: 28.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b15636762ff505d689457efca795499fdf905049cb5de41b45de16e9c02ce8c
|
|
| MD5 |
e2f7b4b342b2c7bf73e0e5942f1bacf6
|
|
| BLAKE2b-256 |
866fc91bfb95316a46a8a172ce598da64b8f6dc438e1fc207c0fc9e4da5371bd
|