Skip to content

Commit cd29922

Browse files
rolanbadrislamovCocossoul
authored andcommitted
chore: remove mcp and exposed param decorators (#80)
1 parent 986ef44 commit cd29922

5 files changed

Lines changed: 4 additions & 154 deletions

File tree

src/sap_cloud_sdk/agent_decorators/__init__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
33
Decorator-based configuration-as-code for SAP AI agents. Developers
44
annotate functions with decorators to expose configuration fields
5-
(prompts, models, settings, MCP servers) to a low-code UI.
5+
(prompts, models, settings) to a low-code UI.
66
77
Usage:
88
from sap_cloud_sdk.agent_decorators import (
99
prompt_section,
1010
agent_config,
1111
agent_model,
12-
mcp_server,
13-
exposed_param,
1412
)
1513
1614
@prompt_section(
@@ -25,8 +23,6 @@ def system_prompt() -> str:
2523
from sap_cloud_sdk.agent_decorators.decorators import (
2624
agent_config,
2725
agent_model,
28-
exposed_param,
29-
mcp_server,
3026
prompt_section,
3127
)
3228
from sap_cloud_sdk.agent_decorators.exceptions import (
@@ -38,8 +34,6 @@ def system_prompt() -> str:
3834
"prompt_section",
3935
"agent_config",
4036
"agent_model",
41-
"mcp_server",
42-
"exposed_param",
4337
# Exceptions
4438
"AgentDecoratorError",
4539
]

src/sap_cloud_sdk/agent_decorators/decorators.py

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -136,75 +136,3 @@ def decorator(fn: Callable) -> Callable:
136136
return fn
137137

138138
return decorator
139-
140-
141-
def mcp_server(
142-
key: str,
143-
label: str,
144-
description: str,
145-
) -> Callable:
146-
"""Expose an MCP server configuration.
147-
148-
Args:
149-
key: Unique identifier (e.g. ``"mcp.filesystem"``).
150-
label: Human-readable label.
151-
description: Help text.
152-
153-
Returns:
154-
A decorator that validates the key and returns the function unchanged.
155-
156-
Raises:
157-
AgentDecoratorError: If the key is empty or whitespace-only.
158-
159-
Example::
160-
161-
@mcp_server(
162-
key="mcp.filesystem",
163-
label="Filesystem Server",
164-
description="MCP server for file operations",
165-
)
166-
def get_fs_server() -> dict:
167-
return {"command": "npx", "args": ["-y", "@anthropic/mcp-fs"]}
168-
"""
169-
_validate_key(key)
170-
171-
def decorator(fn: Callable) -> Callable:
172-
return fn
173-
174-
return decorator
175-
176-
177-
def exposed_param(
178-
key: str,
179-
label: str,
180-
description: str,
181-
) -> Callable:
182-
"""Expose a runtime parameter for editing.
183-
184-
Args:
185-
key: Unique identifier (e.g. ``"params.max_retries"``).
186-
label: Human-readable label.
187-
description: Help text.
188-
189-
Returns:
190-
A decorator that validates the key and returns the function unchanged.
191-
192-
Raises:
193-
AgentDecoratorError: If the key is empty or whitespace-only.
194-
195-
Example::
196-
197-
@exposed_param(
198-
key="params.max_retries",
199-
label="Max Retries",
200-
description="Number of retry attempts for failed requests",
201-
)
202-
def get_max_retries() -> int:
203-
return 3
204-
"""
205-
_validate_key(key)
206-
207-
def decorator(fn: Callable) -> Callable:
208-
return fn
209-
210-
return decorator

src/sap_cloud_sdk/agent_decorators/user-guide.md

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Agent Decorators User Guide
22

3-
This module provides a decorator-based configuration-as-code system for SAP AI agents. Developers annotate functions with decorators to expose configuration fields — prompts, model selections, agent settings, and MCP servers — to a low-code UI. External tooling discovers these markers in source text and extracts their arguments and return values.
3+
This module provides a decorator-based configuration-as-code system for SAP AI agents. Developers annotate functions with decorators to expose configuration fields — prompts, model selections, and agent settings — to a low-code UI. External tooling discovers these markers in source text and extracts their arguments and return values.
44

55
## Installation
66

@@ -13,8 +13,6 @@ from sap_cloud_sdk.agent_decorators import (
1313
prompt_section,
1414
agent_config,
1515
agent_model,
16-
mcp_server,
17-
exposed_param,
1816
)
1917
```
2018

@@ -89,41 +87,6 @@ def default_model() -> str:
8987
return "gpt-4"
9088
```
9189

92-
### @mcp_server
93-
94-
Expose an MCP (Model Context Protocol) server configuration.
95-
96-
```python
97-
from sap_cloud_sdk.agent_decorators import mcp_server
98-
99-
@mcp_server(
100-
key="mcp.filesystem",
101-
label="Filesystem Server",
102-
description="MCP server for filesystem access",
103-
)
104-
def filesystem_server() -> dict:
105-
return {
106-
"command": "npx",
107-
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/data"],
108-
}
109-
```
110-
111-
### @exposed_param
112-
113-
Expose a runtime parameter for editing.
114-
115-
```python
116-
from sap_cloud_sdk.agent_decorators import exposed_param
117-
118-
@exposed_param(
119-
key="params.max_retries",
120-
label="Max Retries",
121-
description="Number of retry attempts for failed requests",
122-
)
123-
def max_retries() -> int:
124-
return 3
125-
```
126-
12790
## Error Handling
12891

12992
```python

tests/agent_decorators/unit/test_decorators.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
from sap_cloud_sdk.agent_decorators.decorators import (
66
agent_config,
77
agent_model,
8-
exposed_param,
9-
mcp_server,
108
prompt_section,
119
)
1210
from sap_cloud_sdk.agent_decorators.exceptions import AgentDecoratorError
@@ -71,37 +69,6 @@ def model():
7169

7270
assert model() == "claude-3"
7371

74-
75-
class TestMcpServer:
76-
"""Tests for @mcp_server decorator."""
77-
78-
def test_function_still_callable(self):
79-
@mcp_server(
80-
key="mcp.filesystem",
81-
label="Filesystem Server",
82-
description="MCP server for filesystem access",
83-
)
84-
def fs_server():
85-
return {"command": "python", "args": ["-m", "server"]}
86-
87-
assert fs_server() == {"command": "python", "args": ["-m", "server"]}
88-
89-
90-
class TestExposedParam:
91-
"""Tests for @exposed_param decorator."""
92-
93-
def test_function_still_callable(self):
94-
@exposed_param(
95-
key="params.max_retries",
96-
label="Max Retries",
97-
description="Number of retry attempts for failed requests",
98-
)
99-
def max_retries():
100-
return 3
101-
102-
assert max_retries() == 3
103-
104-
10572
class TestKeyValidation:
10673
"""Tests for decorator key validation."""
10774

@@ -122,7 +89,7 @@ def bad():
12289
def test_none_key_raises_error(self):
12390
with pytest.raises(AgentDecoratorError, match="non-empty string"):
12491

125-
@mcp_server(key=None, label="L", description="D") # ty: ignore[invalid-argument-type]
92+
@agent_model(key=None, label="L") # ty: ignore[invalid-argument-type]
12693
def bad():
12794
return {}
12895

@@ -138,8 +105,6 @@ def test_all_decorators_validate_key(self):
138105
lambda fn: prompt_section(key="", label="L", description="D")(fn),
139106
lambda fn: agent_config(key="", label="L", description="D")(fn),
140107
lambda fn: agent_model(key="", label="L")(fn),
141-
lambda fn: mcp_server(key="", label="L", description="D")(fn),
142-
lambda fn: exposed_param(key="", label="L", description="D")(fn),
143108
]
144109

145110
for dec in decorators:

tests/core/unit/auditlog_ng/unit/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _make_config(**overrides: Unpack[ConfigKwargs]) -> AuditLogNGConfig:
3434
"namespace": "namespace-123",
3535
"insecure": True,
3636
}
37-
defaults.update(overrides) # ty: ignore[invalid-argument-type]
37+
defaults.update(overrides)
3838
return AuditLogNGConfig(**defaults)
3939

4040

0 commit comments

Comments
 (0)