onetool-mcp 1.0.0rc2__py3-none-any.whl → 1.0.0rc3__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.
Files changed (34) hide show
  1. onetool/cli.py +2 -0
  2. {onetool_mcp-1.0.0rc2.dist-info → onetool_mcp-1.0.0rc3.dist-info}/METADATA +26 -33
  3. {onetool_mcp-1.0.0rc2.dist-info → onetool_mcp-1.0.0rc3.dist-info}/RECORD +31 -33
  4. ot/config/__init__.py +90 -48
  5. ot/config/global_templates/__init__.py +2 -2
  6. ot/config/global_templates/diagram-templates/api-flow.mmd +33 -33
  7. ot/config/global_templates/diagram-templates/c4-context.puml +30 -30
  8. ot/config/global_templates/diagram-templates/class-diagram.mmd +87 -87
  9. ot/config/global_templates/diagram-templates/feature-mindmap.mmd +70 -70
  10. ot/config/global_templates/diagram-templates/microservices.d2 +81 -81
  11. ot/config/global_templates/diagram-templates/project-gantt.mmd +37 -37
  12. ot/config/global_templates/diagram-templates/state-machine.mmd +42 -42
  13. ot/config/global_templates/diagram.yaml +167 -167
  14. ot/config/global_templates/onetool.yaml +2 -0
  15. ot/config/global_templates/prompts.yaml +102 -102
  16. ot/config/global_templates/security.yaml +1 -4
  17. ot/config/global_templates/servers.yaml +1 -1
  18. ot/config/global_templates/tool_templates/__init__.py +7 -7
  19. ot/config/loader.py +226 -869
  20. ot/config/models.py +735 -0
  21. ot/config/secrets.py +243 -192
  22. ot/executor/tool_loader.py +10 -1
  23. ot/executor/validator.py +11 -1
  24. ot/meta.py +338 -33
  25. ot/prompts.py +228 -218
  26. ot/proxy/manager.py +168 -8
  27. ot/registry/__init__.py +199 -189
  28. ot/config/dynamic.py +0 -121
  29. ot/config/mcp.py +0 -149
  30. ot/config/tool_config.py +0 -125
  31. {onetool_mcp-1.0.0rc2.dist-info → onetool_mcp-1.0.0rc3.dist-info}/WHEEL +0 -0
  32. {onetool_mcp-1.0.0rc2.dist-info → onetool_mcp-1.0.0rc3.dist-info}/entry_points.txt +0 -0
  33. {onetool_mcp-1.0.0rc2.dist-info → onetool_mcp-1.0.0rc3.dist-info}/licenses/LICENSE.txt +0 -0
  34. {onetool_mcp-1.0.0rc2.dist-info → onetool_mcp-1.0.0rc3.dist-info}/licenses/NOTICE.txt +0 -0
ot/config/tool_config.py DELETED
@@ -1,125 +0,0 @@
1
- """Runtime tool configuration accessor.
2
-
3
- This module provides the primary interface for tools to access their
4
- configuration at runtime. Tools call get_tool_config() with their pack
5
- name and optional Config schema class.
6
-
7
- Example usage in a tool file:
8
- from pydantic import BaseModel, Field
9
-
10
- pack = "brave"
11
-
12
- class Config(BaseModel):
13
- timeout: float = Field(default=60.0, ge=1.0, le=300.0)
14
-
15
- def search(query: str) -> str:
16
- from ot.config.tool_config import get_tool_config
17
- config = get_tool_config("brave", Config)
18
- # config.timeout is typed and validated
19
- ...
20
- """
21
-
22
- from __future__ import annotations
23
-
24
- from typing import Any, TypeVar, overload
25
-
26
- from pydantic import BaseModel
27
-
28
- T = TypeVar("T", bound=BaseModel)
29
-
30
-
31
- @overload
32
- def get_tool_config(pack: str, schema: type[T]) -> T: ...
33
-
34
-
35
- @overload
36
- def get_tool_config(pack: str, schema: None = None) -> dict[str, Any]: ...
37
-
38
-
39
- def get_tool_config(
40
- pack: str, schema: type[T] | None = None
41
- ) -> T | dict[str, Any]:
42
- """Get configuration for a tool pack.
43
-
44
- Args:
45
- pack: Pack name (e.g., "brave", "ground", "context7")
46
- schema: Optional Pydantic model class to validate and return typed config.
47
- If provided, returns an instance of the schema with merged values.
48
- If None, returns raw config dict.
49
-
50
- Returns:
51
- If schema provided: Instance of schema with config values merged
52
- If no schema: Dict with raw config values (empty dict if not configured)
53
-
54
- Example:
55
- # With schema (recommended for type safety)
56
- class Config(BaseModel):
57
- timeout: float = 60.0
58
-
59
- config = get_tool_config("brave", Config)
60
- print(config.timeout) # typed as float
61
-
62
- # Without schema (raw dict)
63
- raw = get_tool_config("brave")
64
- print(raw.get("timeout", 60.0))
65
- """
66
- # Get raw config values for this pack
67
- raw_config = _get_raw_config(pack)
68
-
69
- if schema is None:
70
- return raw_config
71
-
72
- # Validate and return typed config instance
73
- try:
74
- return schema.model_validate(raw_config)
75
- except Exception:
76
- # If validation fails, return defaults from schema
77
- return schema()
78
-
79
-
80
- def _get_raw_config(pack: str) -> dict[str, Any]:
81
- """Get raw config dict for a pack from loaded configuration.
82
-
83
- This function handles both typed tools.X fields and extra fields
84
- allowed via model_config. It supports:
85
- 1. Typed tools.X fields (e.g., tools.stats)
86
- 2. Extra fields for tool packs (e.g., tools.brave)
87
-
88
- Args:
89
- pack: Pack name (e.g., "brave", "ground")
90
-
91
- Returns:
92
- Raw config dict for the pack, or empty dict if not configured
93
- """
94
- from ot.config.loader import get_config
95
-
96
- try:
97
- config = get_config()
98
- except Exception:
99
- # Config not loaded yet - return empty dict
100
- return {}
101
-
102
- # Get the tools section
103
- tools = config.tools
104
-
105
- # First check for typed attribute (e.g., tools.stats)
106
- if hasattr(tools, pack):
107
- pack_config = getattr(tools, pack)
108
- if hasattr(pack_config, "model_dump"):
109
- result: dict[str, Any] = pack_config.model_dump()
110
- return result
111
- # Handle raw dict from extra fields
112
- if isinstance(pack_config, dict):
113
- return pack_config
114
- return {}
115
-
116
- # Check model_extra for dynamically allowed fields
117
- if hasattr(tools, "model_extra") and tools.model_extra:
118
- extra = tools.model_extra
119
- if pack in extra:
120
- pack_data = extra[pack]
121
- if isinstance(pack_data, dict):
122
- return pack_data
123
- return {}
124
-
125
- return {}