Consent/permission decorator for the Model Context Standard.
Project description
mcs-permission
Consent / permission decorator for the Model Context Standard (MCS).
Provides PermissionDecorator -- a BaseDecorator that gates tool execution
behind a consent callback. Before execute_tool runs, the decorator asks the
client whether the pending tool call (name + arguments) is allowed; on denial it
returns a structured permission_denied result instead of executing.
Installation
pip install mcs-permission
Usage
from mcs.permission.decorator import PermissionDecorator
def ask_user(tool_name, arguments) -> bool:
return input(f"Run {tool_name}? [y/N] ").strip().lower() == "y"
guarded = PermissionDecorator(MyToolDriver(...), consent=ask_user)
orchestrator.add_driver(guarded, label="mail")
It wraps the ToolDriver layer, so the surrounding orchestrator keeps its
process_llm_response loop and calls execute_tool -- the decorator -- beneath
it. Decorators stack: PermissionDecorator(AuthDecorator(RealToolDriver))
checks consent first and handles auth challenges deeper down.
Advertises the "consent" capability and is reachable via
DriverMeta.resolve_capability(driver, SupportsConsent).
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
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_permission-0.1.0.tar.gz.
File metadata
- Download URL: mcs_permission-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c23fd7ecbbf09bd29e68199b216e1d94a43a46b88949eb41880915a0ce0d8bb
|
|
| MD5 |
fbf8121582556ec9469edc5e588ad38b
|
|
| BLAKE2b-256 |
f2ee7e6d80c386bdeaf0312034bfc58ace74cbeaa4489f85f891f764c668d2ee
|
File details
Details for the file mcs_permission-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcs_permission-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 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 |
01c85e6f840f40eaae9fdf1245b9d74582c22d28d2a3485c3b83a4ecb0a1d091
|
|
| MD5 |
5d02ed2a8c87c33763e4977c9aaba412
|
|
| BLAKE2b-256 |
06b2bd9f2ddd54e14735d2762704405fbe6c3141e4bf87d47ea668029ccc327e
|