arcade-core 3.3.2__py3-none-any.whl → 3.3.4__py3-none-any.whl
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.
arcade_core/catalog.py
CHANGED
|
@@ -266,22 +266,37 @@ class ToolCatalog(BaseModel):
|
|
|
266
266
|
output_model=output_model,
|
|
267
267
|
)
|
|
268
268
|
|
|
269
|
-
def add_module(
|
|
269
|
+
def add_module(
|
|
270
|
+
self,
|
|
271
|
+
module: ModuleType,
|
|
272
|
+
name: str | None = None,
|
|
273
|
+
version: str | None = None,
|
|
274
|
+
description: str | None = None,
|
|
275
|
+
) -> None:
|
|
270
276
|
"""
|
|
271
277
|
Add all the tools in a module to the catalog.
|
|
272
278
|
|
|
273
279
|
Args:
|
|
274
280
|
module: The module to add.
|
|
275
281
|
name: Optionally override the name of the toolkit with this parameter
|
|
282
|
+
version: Optionally override the version of the toolkit with this parameter
|
|
283
|
+
description: Optionally override the description of the toolkit with this parameter
|
|
276
284
|
"""
|
|
277
285
|
toolkit = Toolkit.from_module(module)
|
|
278
286
|
if name:
|
|
279
287
|
toolkit.name = name
|
|
280
|
-
self.add_toolkit(toolkit)
|
|
288
|
+
self.add_toolkit(toolkit, version=version, description=description)
|
|
281
289
|
|
|
282
|
-
def add_toolkit(
|
|
290
|
+
def add_toolkit(
|
|
291
|
+
self, toolkit: Toolkit, version: str | None = None, description: str | None = None
|
|
292
|
+
) -> None:
|
|
283
293
|
"""
|
|
284
294
|
Add the tools from a loaded toolkit to the catalog.
|
|
295
|
+
|
|
296
|
+
Args:
|
|
297
|
+
toolkit: The toolkit to add.
|
|
298
|
+
version: Optionally override the version of the toolkit with this parameter
|
|
299
|
+
description: Optionally override the description of the toolkit with this parameter
|
|
285
300
|
"""
|
|
286
301
|
|
|
287
302
|
if str(toolkit).lower() in self._disabled_toolkits:
|
|
@@ -293,7 +308,13 @@ class ToolCatalog(BaseModel):
|
|
|
293
308
|
try:
|
|
294
309
|
module = import_module(module_name)
|
|
295
310
|
tool_func = getattr(module, tool_name)
|
|
296
|
-
self.add_tool(
|
|
311
|
+
self.add_tool(
|
|
312
|
+
tool_func,
|
|
313
|
+
toolkit,
|
|
314
|
+
module,
|
|
315
|
+
toolkit_version=version,
|
|
316
|
+
toolkit_description=description,
|
|
317
|
+
)
|
|
297
318
|
except ToolDefinitionError as e:
|
|
298
319
|
raise e.with_context(tool_name) from e
|
|
299
320
|
except ToolkitLoadError as e:
|
arcade_core/schema.py
CHANGED
|
@@ -19,7 +19,7 @@ from __future__ import annotations
|
|
|
19
19
|
import os
|
|
20
20
|
from dataclasses import dataclass
|
|
21
21
|
from enum import Enum
|
|
22
|
-
from typing import Any, Literal
|
|
22
|
+
from typing import Any, Literal, Protocol
|
|
23
23
|
|
|
24
24
|
from pydantic import BaseModel, Field
|
|
25
25
|
|
|
@@ -29,6 +29,75 @@ from arcade_core.errors import ErrorKind
|
|
|
29
29
|
TOOL_NAME_SEPARATOR = os.getenv("ARCADE_TOOL_NAME_SEPARATOR", ".")
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
# =====================
|
|
33
|
+
# MCP Feature Protocols and No-Op Implementations
|
|
34
|
+
# =====================
|
|
35
|
+
# These protocols and stubs enable graceful degradation of MCP features
|
|
36
|
+
# in deployed (non-local) environments where the full MCP context is not available.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class LogsProtocol(Protocol):
|
|
40
|
+
"""Protocol for logging interface."""
|
|
41
|
+
|
|
42
|
+
async def log(
|
|
43
|
+
self,
|
|
44
|
+
level: str,
|
|
45
|
+
message: str,
|
|
46
|
+
logger_name: str | None = None,
|
|
47
|
+
extra: dict[str, Any] | None = None,
|
|
48
|
+
) -> None: ...
|
|
49
|
+
|
|
50
|
+
async def debug(self, message: str, **kwargs: Any) -> None: ...
|
|
51
|
+
|
|
52
|
+
async def info(self, message: str, **kwargs: Any) -> None: ...
|
|
53
|
+
|
|
54
|
+
async def warning(self, message: str, **kwargs: Any) -> None: ...
|
|
55
|
+
|
|
56
|
+
async def error(self, message: str, **kwargs: Any) -> None: ...
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class ProgressProtocol(Protocol):
|
|
60
|
+
"""Protocol for progress reporting interface."""
|
|
61
|
+
|
|
62
|
+
async def report(
|
|
63
|
+
self, progress: float, total: float | None = None, message: str | None = None
|
|
64
|
+
) -> None: ...
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class _NoOpLogs:
|
|
68
|
+
"""No-op implementation for logging in deployed environments."""
|
|
69
|
+
|
|
70
|
+
async def log(
|
|
71
|
+
self,
|
|
72
|
+
level: str,
|
|
73
|
+
message: str,
|
|
74
|
+
logger_name: str | None = None,
|
|
75
|
+
extra: dict[str, Any] | None = None,
|
|
76
|
+
) -> None:
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
async def debug(self, message: str, **kwargs: Any) -> None:
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
async def info(self, message: str, **kwargs: Any) -> None:
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
async def warning(self, message: str, **kwargs: Any) -> None:
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
async def error(self, message: str, **kwargs: Any) -> None:
|
|
89
|
+
pass
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class _NoOpProgress:
|
|
93
|
+
"""No-op implementation for progress in deployed environments."""
|
|
94
|
+
|
|
95
|
+
async def report(
|
|
96
|
+
self, progress: float, total: float | None = None, message: str | None = None
|
|
97
|
+
) -> None:
|
|
98
|
+
pass
|
|
99
|
+
|
|
100
|
+
|
|
32
101
|
class ValueSchema(BaseModel):
|
|
33
102
|
"""Value schema for input parameters and outputs."""
|
|
34
103
|
|
|
@@ -390,6 +459,75 @@ class ToolContext(BaseModel):
|
|
|
390
459
|
|
|
391
460
|
raise ValueError(f"{item_name.capitalize()} '{key}' not found in context.")
|
|
392
461
|
|
|
462
|
+
# ============ MCP Feature Properties ============
|
|
463
|
+
# Non-critical features (no-op in deployed environments)
|
|
464
|
+
|
|
465
|
+
@property
|
|
466
|
+
def log(self) -> LogsProtocol:
|
|
467
|
+
"""No-op logging interface (not supported in deployed environments)."""
|
|
468
|
+
return _NoOpLogs()
|
|
469
|
+
|
|
470
|
+
@property
|
|
471
|
+
def progress(self) -> ProgressProtocol:
|
|
472
|
+
"""No-op progress reporting (not supported in deployed environments)."""
|
|
473
|
+
return _NoOpProgress()
|
|
474
|
+
|
|
475
|
+
# Critical features (raise error in deployed environments)
|
|
476
|
+
|
|
477
|
+
@property
|
|
478
|
+
def resources(self) -> Any:
|
|
479
|
+
"""Resources are not available in deployed environments."""
|
|
480
|
+
raise RuntimeError(
|
|
481
|
+
"The resources feature is not supported for Arcade managed servers (non-local)"
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
@property
|
|
485
|
+
def tools(self) -> Any:
|
|
486
|
+
"""Tool calling is not available in deployed environments."""
|
|
487
|
+
raise RuntimeError(
|
|
488
|
+
"The tools feature is not supported for Arcade managed servers (non-local)"
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
@property
|
|
492
|
+
def prompts(self) -> Any:
|
|
493
|
+
"""Prompts are not available in deployed environments."""
|
|
494
|
+
raise RuntimeError(
|
|
495
|
+
"The prompts feature is not supported for Arcade managed servers (non-local)"
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
@property
|
|
499
|
+
def sampling(self) -> Any:
|
|
500
|
+
"""Sampling is not available in deployed environments."""
|
|
501
|
+
raise RuntimeError(
|
|
502
|
+
"The sampling feature is not supported for Arcade managed servers (non-local)"
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
@property
|
|
506
|
+
def ui(self) -> Any:
|
|
507
|
+
"""UI/elicitation is not available in deployed environments."""
|
|
508
|
+
raise RuntimeError("The ui feature is not supported for Arcade managed servers (non-local)")
|
|
509
|
+
|
|
510
|
+
@property
|
|
511
|
+
def notifications(self) -> Any:
|
|
512
|
+
"""Notifications are not available in deployed environments."""
|
|
513
|
+
raise RuntimeError(
|
|
514
|
+
"The notifications feature is not supported for Arcade managed servers (non-local)"
|
|
515
|
+
)
|
|
516
|
+
|
|
517
|
+
@property
|
|
518
|
+
def request_id(self) -> Any:
|
|
519
|
+
"""Request ID is not available in deployed environments."""
|
|
520
|
+
raise RuntimeError(
|
|
521
|
+
"The request_id feature is not supported for Arcade managed servers (non-local)"
|
|
522
|
+
)
|
|
523
|
+
|
|
524
|
+
@property
|
|
525
|
+
def session_id(self) -> Any:
|
|
526
|
+
"""Session ID is not available in deployed environments."""
|
|
527
|
+
raise RuntimeError(
|
|
528
|
+
"The session_id feature is not supported for Arcade managed servers (non-local)"
|
|
529
|
+
)
|
|
530
|
+
|
|
393
531
|
|
|
394
532
|
class ToolCallRequest(BaseModel):
|
|
395
533
|
"""The request to call (invoke) a tool."""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
arcade_core/__init__.py,sha256=1heu3AROAjpistehPzY2H-2nkj_IjQEh-vVlVOCRF1E,88
|
|
2
2
|
arcade_core/annotations.py,sha256=Nst6aejLWXlpTu7GwzWETu1gQCG1XVAUR_qcFbNvyRc,198
|
|
3
3
|
arcade_core/auth.py,sha256=On9sJPOxvHjKBxgKC1yqp7oijF6KYBsG6fG8KUw-9OY,5882
|
|
4
|
-
arcade_core/catalog.py,sha256=
|
|
4
|
+
arcade_core/catalog.py,sha256=AA13L-ZG4O0S5rB1Fjc-wpLaa6im-dwIBx7GsE2ZW80,43527
|
|
5
5
|
arcade_core/config.py,sha256=e98XQAkYySGW9T_yrJg54BB8Wuq06GPVHp7xqe2d1vU,572
|
|
6
6
|
arcade_core/config_model.py,sha256=78BR6Ch9BDuG4ddWGfpuEKqWcb1fyOF6kxiF4qLFogM,4481
|
|
7
7
|
arcade_core/constants.py,sha256=wakdklI7TyJ0agq9n-Cmb2lbVa95D0oUaMGm30eiv9Y,375
|
|
@@ -12,7 +12,7 @@ arcade_core/executor.py,sha256=aFRqB4OdC4b8JJN3zekx0hOWYmihWHAZqVWVlSFXzE4,4308
|
|
|
12
12
|
arcade_core/output.py,sha256=CMY1pHlQIR27Beiz2I-Yg1aO-P-pbsEbhBZ1RdYuflc,4040
|
|
13
13
|
arcade_core/parse.py,sha256=arKGKL9C6g__tRfZ4re6IM_wAqr1v3LrOzTOBEDLhDc,2366
|
|
14
14
|
arcade_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
arcade_core/schema.py,sha256=
|
|
15
|
+
arcade_core/schema.py,sha256=y32Ndlb1b3Hw7_Wm3eVXxh0kSg3oGitWUYBfwFLjHuY,21198
|
|
16
16
|
arcade_core/toolkit.py,sha256=lLlOL6fA6Lmo-dtLTMMcPCzKDf9YQObwxG1LdVADv3E,14431
|
|
17
17
|
arcade_core/utils.py,sha256=_3bM-yfIDFmMVqt-NFYp2Lx1QcNWp7xytGjUQzPs2LY,3255
|
|
18
18
|
arcade_core/version.py,sha256=CpXi3jGlx23RvRyU7iytOMZrnspdWw4yofS8lpP1AJU,18
|
|
@@ -23,6 +23,6 @@ arcade_core/usage/constants.py,sha256=1FQIhkFFMZUhU-H4A7GvMb7KQ3qLFrNAZb2-LEvSF3
|
|
|
23
23
|
arcade_core/usage/identity.py,sha256=2dP1iusI9pE_GrPlz3VXEdz51R5JlNo9_-OXbe6vn7I,6716
|
|
24
24
|
arcade_core/usage/usage_service.py,sha256=xzWWSEktm58liiNYugBHRactSru8V5foriHcsoH0j1A,3407
|
|
25
25
|
arcade_core/usage/utils.py,sha256=FqBOmlhwT68cbnpI5Vx9ZW6vLRYPVg4FJ0GaMEp8qEM,398
|
|
26
|
-
arcade_core-3.3.
|
|
27
|
-
arcade_core-3.3.
|
|
28
|
-
arcade_core-3.3.
|
|
26
|
+
arcade_core-3.3.4.dist-info/METADATA,sha256=FMQ0jM6jmF1V2IuebikCeV5fK4HKphhFthhVBfE30uY,2383
|
|
27
|
+
arcade_core-3.3.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
28
|
+
arcade_core-3.3.4.dist-info/RECORD,,
|
|
File without changes
|