mcs-driver-core 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mcs_driver_core-0.2.0/src/mcs_driver_core.egg-info → mcs_driver_core-0.2.2}/PKG-INFO +1 -1
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/pyproject.toml +4 -1
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/mcs_tool_driver_interface.py +38 -6
- mcs_driver_core-0.2.2/src/mcs/driver/core/prompts/default_json.toml +68 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2/src/mcs_driver_core.egg-info}/PKG-INFO +1 -1
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs_driver_core.egg-info/SOURCES.txt +1 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/LICENSE +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/README.md +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/setup.cfg +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/__init__.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/base.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/extraction_strategy.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/mcs_driver_interface.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/mixins/__init__.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/mixins/driver_context_mixin.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/mixins/healthcheck.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/mixins/tool_call_signaling_mixin.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/prompt_strategy.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs_driver_core.egg-info/dependency_links.txt +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs_driver_core.egg-info/requires.txt +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs_driver_core.egg-info/top_level.txt +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/tests/test_driver_base.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/tests/test_extraction_strategy.py +0 -0
- {mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/tests/test_prompt_strategy.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "mcs-driver-core"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
description = "Core driver contract for the Model Context Standard."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -42,3 +42,6 @@ dev = [
|
|
|
42
42
|
|
|
43
43
|
[tool.setuptools.packages.find]
|
|
44
44
|
where = ["src"]
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.package-data]
|
|
47
|
+
"mcs.driver.core" = ["prompts/*.toml"]
|
{mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/mcs_tool_driver_interface.py
RENAMED
|
@@ -49,18 +49,50 @@ class Tool:
|
|
|
49
49
|
that an external entity (e.g., an orchestrator or an LLM capable of
|
|
50
50
|
tool-calling) can understand and invoke.
|
|
51
51
|
|
|
52
|
+
The three-tier identification mirrors both MCP and OpenAPI conventions:
|
|
53
|
+
|
|
54
|
+
* ``name`` -- machine identifier (MCP ``name``, OpenAPI ``operationId``)
|
|
55
|
+
* ``title`` -- short human-readable label (MCP ``title``, OpenAPI ``summary``)
|
|
56
|
+
* ``description`` -- full text forwarded to the LLM, may contain multi-line
|
|
57
|
+
prompt-engineering instructions (MCP ``description``, OpenAPI ``description``)
|
|
58
|
+
|
|
59
|
+
A client or orchestrator can choose to expose only ``name`` + ``title``
|
|
60
|
+
to the LLM to save context-window tokens and load the full
|
|
61
|
+
``description`` on demand when a tool is actually selected.
|
|
62
|
+
|
|
63
|
+
At least one of ``title`` or ``description`` must be provided.
|
|
64
|
+
When only ``title`` is given, ``description`` is auto-filled from it
|
|
65
|
+
so that downstream consumers (e.g. ``PromptStrategy.format_tools``)
|
|
66
|
+
always find a non-empty ``description``.
|
|
67
|
+
|
|
52
68
|
Attributes
|
|
53
69
|
----------
|
|
54
70
|
name : str
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
Unique machine-readable identifier for the tool.
|
|
72
|
+
title : str or None
|
|
73
|
+
Optional short human-readable label for display and token-efficient
|
|
74
|
+
tool listings. Maps to OpenAPI ``summary`` / MCP ``title``.
|
|
75
|
+
description : str or None
|
|
76
|
+
Detailed description forwarded to the LLM. May include usage
|
|
77
|
+
instructions, constraints and examples. Auto-filled from
|
|
78
|
+
``title`` when not provided explicitly.
|
|
58
79
|
parameters : list[ToolParameter]
|
|
59
|
-
|
|
80
|
+
Inputs required by the tool.
|
|
60
81
|
"""
|
|
61
82
|
name: str
|
|
62
|
-
|
|
63
|
-
|
|
83
|
+
title: Optional[str] = None
|
|
84
|
+
description: Optional[str] = None
|
|
85
|
+
parameters: list[ToolParameter] = None # type: ignore[assignment]
|
|
86
|
+
|
|
87
|
+
def __post_init__(self) -> None:
|
|
88
|
+
if self.parameters is None:
|
|
89
|
+
self.parameters = []
|
|
90
|
+
if not self.description and self.title:
|
|
91
|
+
self.description = self.title
|
|
92
|
+
if not self.description and not self.title:
|
|
93
|
+
raise ValueError(
|
|
94
|
+
f"Tool '{self.name}': at least one of 'title' or 'description' must be provided."
|
|
95
|
+
)
|
|
64
96
|
|
|
65
97
|
|
|
66
98
|
class MCSToolDriver(ABC):
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[meta]
|
|
2
|
+
name = "json-default"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
|
|
5
|
+
# ── Prompt Generation ──────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
[system_message]
|
|
8
|
+
template = """
|
|
9
|
+
You are a helpful assistant with access to these tools:
|
|
10
|
+
|
|
11
|
+
{tools}
|
|
12
|
+
|
|
13
|
+
Choose the appropriate tool based on the user's question.
|
|
14
|
+
If no tool is needed, reply directly.
|
|
15
|
+
|
|
16
|
+
IMPORTANT: When you need to use a tool, respond with ONLY this format:
|
|
17
|
+
{call_example}
|
|
18
|
+
|
|
19
|
+
After receiving a tool's response:
|
|
20
|
+
1. Transform the raw data into a natural, conversational response
|
|
21
|
+
2. Keep responses concise but informative
|
|
22
|
+
3. Focus on the most relevant information
|
|
23
|
+
4. Use appropriate context from the user's question
|
|
24
|
+
5. Avoid simply repeating the raw data
|
|
25
|
+
|
|
26
|
+
Please use only the tools that are explicitly defined above.
|
|
27
|
+
If you want to use a tool, ALWAYS reply with the JSON object format.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
[call_example]
|
|
31
|
+
example = """\
|
|
32
|
+
{
|
|
33
|
+
"tool": "tool-name",
|
|
34
|
+
"arguments": {
|
|
35
|
+
"argument-name": "value"
|
|
36
|
+
}
|
|
37
|
+
}"""
|
|
38
|
+
|
|
39
|
+
# ── Parsing Configuration ──────────────────────────────────
|
|
40
|
+
|
|
41
|
+
[parsing]
|
|
42
|
+
tool_field_aliases = ["tool", "name"]
|
|
43
|
+
unknown_tool_behavior = "silent"
|
|
44
|
+
|
|
45
|
+
# ── Retry Prompts (placeholders: {tool_name}, {available}, {error}) ──
|
|
46
|
+
|
|
47
|
+
[retry_prompts]
|
|
48
|
+
no_tool_field = "Return a JSON object with a 'tool' field matching one of the available tool names."
|
|
49
|
+
unknown_tool = "No tool '{tool_name}' found. Available tools: {available}."
|
|
50
|
+
execution_failed = "Tool '{tool_name}' execution failed: {error}. Check argument names and value types, then retry."
|
|
51
|
+
|
|
52
|
+
# ── Healing Rules (regex pairs, applied before the parser) ──
|
|
53
|
+
# New LLM quirks → add a rule here, bump version.
|
|
54
|
+
|
|
55
|
+
[[healing]]
|
|
56
|
+
pattern = '```\w*\s*\n?'
|
|
57
|
+
replacement = ''
|
|
58
|
+
comment = "Opening markdown fence (```json, ```python, etc.)"
|
|
59
|
+
|
|
60
|
+
[[healing]]
|
|
61
|
+
pattern = '\n?```\s*$'
|
|
62
|
+
replacement = ''
|
|
63
|
+
comment = "Closing markdown fence"
|
|
64
|
+
|
|
65
|
+
[[healing]]
|
|
66
|
+
pattern = '``[´`]\w*\s*\n?'
|
|
67
|
+
replacement = ''
|
|
68
|
+
comment = "Known LLM typo: backtick variants"
|
|
@@ -11,6 +11,7 @@ src/mcs/driver/core/mixins/__init__.py
|
|
|
11
11
|
src/mcs/driver/core/mixins/driver_context_mixin.py
|
|
12
12
|
src/mcs/driver/core/mixins/healthcheck.py
|
|
13
13
|
src/mcs/driver/core/mixins/tool_call_signaling_mixin.py
|
|
14
|
+
src/mcs/driver/core/prompts/default_json.toml
|
|
14
15
|
src/mcs_driver_core.egg-info/PKG-INFO
|
|
15
16
|
src/mcs_driver_core.egg-info/SOURCES.txt
|
|
16
17
|
src/mcs_driver_core.egg-info/dependency_links.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs/driver/core/mixins/driver_context_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcs_driver_core-0.2.0 → mcs_driver_core-0.2.2}/src/mcs_driver_core.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|