stravinsky 0.2.67__py3-none-any.whl → 0.4.66__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.

Potentially problematic release.


This version of stravinsky might be problematic. Click here for more details.

Files changed (190) hide show
  1. mcp_bridge/__init__.py +1 -1
  2. mcp_bridge/auth/__init__.py +16 -6
  3. mcp_bridge/auth/cli.py +202 -11
  4. mcp_bridge/auth/oauth.py +1 -2
  5. mcp_bridge/auth/openai_oauth.py +4 -7
  6. mcp_bridge/auth/token_store.py +112 -11
  7. mcp_bridge/cli/__init__.py +1 -1
  8. mcp_bridge/cli/install_hooks.py +503 -107
  9. mcp_bridge/cli/session_report.py +0 -3
  10. mcp_bridge/config/MANIFEST_SCHEMA.md +305 -0
  11. mcp_bridge/config/README.md +276 -0
  12. mcp_bridge/config/__init__.py +2 -2
  13. mcp_bridge/config/hook_config.py +247 -0
  14. mcp_bridge/config/hooks_manifest.json +138 -0
  15. mcp_bridge/config/rate_limits.py +317 -0
  16. mcp_bridge/config/skills_manifest.json +128 -0
  17. mcp_bridge/hooks/HOOKS_SETTINGS.json +17 -4
  18. mcp_bridge/hooks/__init__.py +19 -4
  19. mcp_bridge/hooks/agent_reminder.py +4 -4
  20. mcp_bridge/hooks/auto_slash_command.py +5 -5
  21. mcp_bridge/hooks/budget_optimizer.py +2 -2
  22. mcp_bridge/hooks/claude_limits_hook.py +114 -0
  23. mcp_bridge/hooks/comment_checker.py +3 -4
  24. mcp_bridge/hooks/compaction.py +2 -2
  25. mcp_bridge/hooks/context.py +2 -1
  26. mcp_bridge/hooks/context_monitor.py +2 -2
  27. mcp_bridge/hooks/delegation_policy.py +85 -0
  28. mcp_bridge/hooks/directory_context.py +3 -3
  29. mcp_bridge/hooks/edit_recovery.py +3 -2
  30. mcp_bridge/hooks/edit_recovery_policy.py +49 -0
  31. mcp_bridge/hooks/empty_message_sanitizer.py +2 -2
  32. mcp_bridge/hooks/events.py +160 -0
  33. mcp_bridge/hooks/git_noninteractive.py +4 -4
  34. mcp_bridge/hooks/keyword_detector.py +8 -10
  35. mcp_bridge/hooks/manager.py +43 -22
  36. mcp_bridge/hooks/notification_hook.py +13 -6
  37. mcp_bridge/hooks/parallel_enforcement_policy.py +67 -0
  38. mcp_bridge/hooks/parallel_enforcer.py +5 -5
  39. mcp_bridge/hooks/parallel_execution.py +22 -10
  40. mcp_bridge/hooks/post_tool/parallel_validation.py +103 -0
  41. mcp_bridge/hooks/pre_compact.py +8 -9
  42. mcp_bridge/hooks/pre_tool/agent_spawn_validator.py +115 -0
  43. mcp_bridge/hooks/preemptive_compaction.py +2 -3
  44. mcp_bridge/hooks/routing_notifications.py +80 -0
  45. mcp_bridge/hooks/rules_injector.py +11 -19
  46. mcp_bridge/hooks/session_idle.py +4 -4
  47. mcp_bridge/hooks/session_notifier.py +4 -4
  48. mcp_bridge/hooks/session_recovery.py +4 -5
  49. mcp_bridge/hooks/stravinsky_mode.py +1 -1
  50. mcp_bridge/hooks/subagent_stop.py +1 -3
  51. mcp_bridge/hooks/task_validator.py +2 -2
  52. mcp_bridge/hooks/tmux_manager.py +7 -8
  53. mcp_bridge/hooks/todo_delegation.py +4 -1
  54. mcp_bridge/hooks/todo_enforcer.py +180 -10
  55. mcp_bridge/hooks/tool_messaging.py +113 -10
  56. mcp_bridge/hooks/truncation_policy.py +37 -0
  57. mcp_bridge/hooks/truncator.py +1 -2
  58. mcp_bridge/metrics/cost_tracker.py +115 -0
  59. mcp_bridge/native_search.py +93 -0
  60. mcp_bridge/native_watcher.py +118 -0
  61. mcp_bridge/notifications.py +150 -0
  62. mcp_bridge/orchestrator/enums.py +11 -0
  63. mcp_bridge/orchestrator/router.py +165 -0
  64. mcp_bridge/orchestrator/state.py +32 -0
  65. mcp_bridge/orchestrator/visualization.py +14 -0
  66. mcp_bridge/orchestrator/wisdom.py +34 -0
  67. mcp_bridge/prompts/__init__.py +1 -8
  68. mcp_bridge/prompts/dewey.py +1 -1
  69. mcp_bridge/prompts/planner.py +2 -4
  70. mcp_bridge/prompts/stravinsky.py +53 -31
  71. mcp_bridge/proxy/__init__.py +0 -0
  72. mcp_bridge/proxy/client.py +70 -0
  73. mcp_bridge/proxy/model_server.py +157 -0
  74. mcp_bridge/routing/__init__.py +43 -0
  75. mcp_bridge/routing/config.py +250 -0
  76. mcp_bridge/routing/model_tiers.py +135 -0
  77. mcp_bridge/routing/provider_state.py +261 -0
  78. mcp_bridge/routing/task_classifier.py +190 -0
  79. mcp_bridge/server.py +542 -59
  80. mcp_bridge/server_tools.py +738 -6
  81. mcp_bridge/tools/__init__.py +40 -25
  82. mcp_bridge/tools/agent_manager.py +616 -697
  83. mcp_bridge/tools/background_tasks.py +13 -17
  84. mcp_bridge/tools/code_search.py +70 -53
  85. mcp_bridge/tools/continuous_loop.py +0 -1
  86. mcp_bridge/tools/dashboard.py +19 -0
  87. mcp_bridge/tools/find_code.py +296 -0
  88. mcp_bridge/tools/init.py +1 -0
  89. mcp_bridge/tools/list_directory.py +42 -0
  90. mcp_bridge/tools/lsp/__init__.py +12 -5
  91. mcp_bridge/tools/lsp/manager.py +471 -0
  92. mcp_bridge/tools/lsp/tools.py +723 -207
  93. mcp_bridge/tools/model_invoke.py +1195 -273
  94. mcp_bridge/tools/mux_client.py +75 -0
  95. mcp_bridge/tools/project_context.py +1 -2
  96. mcp_bridge/tools/query_classifier.py +406 -0
  97. mcp_bridge/tools/read_file.py +84 -0
  98. mcp_bridge/tools/replace.py +45 -0
  99. mcp_bridge/tools/run_shell_command.py +38 -0
  100. mcp_bridge/tools/search_enhancements.py +347 -0
  101. mcp_bridge/tools/semantic_search.py +3627 -0
  102. mcp_bridge/tools/session_manager.py +0 -2
  103. mcp_bridge/tools/skill_loader.py +0 -1
  104. mcp_bridge/tools/task_runner.py +5 -7
  105. mcp_bridge/tools/templates.py +3 -3
  106. mcp_bridge/tools/tool_search.py +331 -0
  107. mcp_bridge/tools/write_file.py +29 -0
  108. mcp_bridge/update_manager.py +585 -0
  109. mcp_bridge/update_manager_pypi.py +297 -0
  110. mcp_bridge/utils/cache.py +82 -0
  111. mcp_bridge/utils/process.py +71 -0
  112. mcp_bridge/utils/session_state.py +51 -0
  113. mcp_bridge/utils/truncation.py +76 -0
  114. stravinsky-0.4.66.dist-info/METADATA +517 -0
  115. stravinsky-0.4.66.dist-info/RECORD +198 -0
  116. {stravinsky-0.2.67.dist-info → stravinsky-0.4.66.dist-info}/entry_points.txt +1 -0
  117. stravinsky_claude_assets/HOOKS_INTEGRATION.md +316 -0
  118. stravinsky_claude_assets/agents/HOOKS.md +437 -0
  119. stravinsky_claude_assets/agents/code-reviewer.md +210 -0
  120. stravinsky_claude_assets/agents/comment_checker.md +580 -0
  121. stravinsky_claude_assets/agents/debugger.md +254 -0
  122. stravinsky_claude_assets/agents/delphi.md +495 -0
  123. stravinsky_claude_assets/agents/dewey.md +248 -0
  124. stravinsky_claude_assets/agents/explore.md +1198 -0
  125. stravinsky_claude_assets/agents/frontend.md +472 -0
  126. stravinsky_claude_assets/agents/implementation-lead.md +164 -0
  127. stravinsky_claude_assets/agents/momus.md +464 -0
  128. stravinsky_claude_assets/agents/research-lead.md +141 -0
  129. stravinsky_claude_assets/agents/stravinsky.md +730 -0
  130. stravinsky_claude_assets/commands/delphi.md +9 -0
  131. stravinsky_claude_assets/commands/dewey.md +54 -0
  132. stravinsky_claude_assets/commands/git-master.md +112 -0
  133. stravinsky_claude_assets/commands/index.md +49 -0
  134. stravinsky_claude_assets/commands/publish.md +86 -0
  135. stravinsky_claude_assets/commands/review.md +73 -0
  136. stravinsky_claude_assets/commands/str/agent_cancel.md +70 -0
  137. stravinsky_claude_assets/commands/str/agent_list.md +56 -0
  138. stravinsky_claude_assets/commands/str/agent_output.md +92 -0
  139. stravinsky_claude_assets/commands/str/agent_progress.md +74 -0
  140. stravinsky_claude_assets/commands/str/agent_retry.md +94 -0
  141. stravinsky_claude_assets/commands/str/cancel.md +51 -0
  142. stravinsky_claude_assets/commands/str/clean.md +97 -0
  143. stravinsky_claude_assets/commands/str/continue.md +38 -0
  144. stravinsky_claude_assets/commands/str/index.md +199 -0
  145. stravinsky_claude_assets/commands/str/list_watchers.md +96 -0
  146. stravinsky_claude_assets/commands/str/search.md +205 -0
  147. stravinsky_claude_assets/commands/str/start_filewatch.md +136 -0
  148. stravinsky_claude_assets/commands/str/stats.md +71 -0
  149. stravinsky_claude_assets/commands/str/stop_filewatch.md +89 -0
  150. stravinsky_claude_assets/commands/str/unwatch.md +42 -0
  151. stravinsky_claude_assets/commands/str/watch.md +45 -0
  152. stravinsky_claude_assets/commands/strav.md +53 -0
  153. stravinsky_claude_assets/commands/stravinsky.md +292 -0
  154. stravinsky_claude_assets/commands/verify.md +60 -0
  155. stravinsky_claude_assets/commands/version.md +5 -0
  156. stravinsky_claude_assets/hooks/README.md +248 -0
  157. stravinsky_claude_assets/hooks/comment_checker.py +193 -0
  158. stravinsky_claude_assets/hooks/context.py +38 -0
  159. stravinsky_claude_assets/hooks/context_monitor.py +153 -0
  160. stravinsky_claude_assets/hooks/dependency_tracker.py +73 -0
  161. stravinsky_claude_assets/hooks/edit_recovery.py +46 -0
  162. stravinsky_claude_assets/hooks/execution_state_tracker.py +68 -0
  163. stravinsky_claude_assets/hooks/notification_hook.py +103 -0
  164. stravinsky_claude_assets/hooks/notification_hook_v2.py +96 -0
  165. stravinsky_claude_assets/hooks/parallel_execution.py +241 -0
  166. stravinsky_claude_assets/hooks/parallel_reinforcement.py +106 -0
  167. stravinsky_claude_assets/hooks/parallel_reinforcement_v2.py +112 -0
  168. stravinsky_claude_assets/hooks/pre_compact.py +123 -0
  169. stravinsky_claude_assets/hooks/ralph_loop.py +173 -0
  170. stravinsky_claude_assets/hooks/session_recovery.py +263 -0
  171. stravinsky_claude_assets/hooks/stop_hook.py +89 -0
  172. stravinsky_claude_assets/hooks/stravinsky_metrics.py +164 -0
  173. stravinsky_claude_assets/hooks/stravinsky_mode.py +146 -0
  174. stravinsky_claude_assets/hooks/subagent_stop.py +98 -0
  175. stravinsky_claude_assets/hooks/todo_continuation.py +111 -0
  176. stravinsky_claude_assets/hooks/todo_delegation.py +96 -0
  177. stravinsky_claude_assets/hooks/tool_messaging.py +281 -0
  178. stravinsky_claude_assets/hooks/truncator.py +23 -0
  179. stravinsky_claude_assets/rules/deployment_safety.md +51 -0
  180. stravinsky_claude_assets/rules/integration_wiring.md +89 -0
  181. stravinsky_claude_assets/rules/pypi_deployment.md +220 -0
  182. stravinsky_claude_assets/rules/stravinsky_orchestrator.md +32 -0
  183. stravinsky_claude_assets/settings.json +152 -0
  184. stravinsky_claude_assets/skills/chrome-devtools/SKILL.md +81 -0
  185. stravinsky_claude_assets/skills/sqlite/SKILL.md +77 -0
  186. stravinsky_claude_assets/skills/supabase/SKILL.md +74 -0
  187. stravinsky_claude_assets/task_dependencies.json +34 -0
  188. stravinsky-0.2.67.dist-info/METADATA +0 -284
  189. stravinsky-0.2.67.dist-info/RECORD +0 -76
  190. {stravinsky-0.2.67.dist-info → stravinsky-0.4.66.dist-info}/WHEEL +0 -0
@@ -1,8 +1,7 @@
1
- from mcp.types import Tool, Prompt
2
- from typing import List
1
+ from mcp.types import Prompt, Tool
3
2
 
4
3
 
5
- def get_tool_definitions() -> List[Tool]:
4
+ def get_tool_definitions() -> list[Tool]:
6
5
  """Return all Tool definitions for the Stravinsky MCP server."""
7
6
  return [
8
7
  Tool(
@@ -12,6 +11,7 @@ def get_tool_definitions() -> List[Tool]:
12
11
  "type": "object",
13
12
  "properties": {},
14
13
  },
14
+ meta={"defer_loading": True},
15
15
  ),
16
16
  Tool(
17
17
  name="system_restart",
@@ -20,6 +20,113 @@ def get_tool_definitions() -> List[Tool]:
20
20
  "type": "object",
21
21
  "properties": {},
22
22
  },
23
+ meta={"defer_loading": True},
24
+ ),
25
+ Tool(
26
+ name="tool_search",
27
+ description="Search for tools by name, description, or category. Returns matching tools with their descriptions and parameters. Use this to discover available tools before using them.",
28
+ inputSchema={
29
+ "type": "object",
30
+ "properties": {
31
+ "query": {
32
+ "type": "string",
33
+ "description": "Search query to match against tool names, descriptions, and categories",
34
+ },
35
+ "category": {
36
+ "type": "string",
37
+ "description": "Optional category filter (e.g., 'semantic', 'lsp', 'agent', 'git')",
38
+ },
39
+ "top_k": {
40
+ "type": "integer",
41
+ "description": "Maximum number of results to return",
42
+ "default": 5,
43
+ },
44
+ },
45
+ "required": ["query"],
46
+ },
47
+ ),
48
+ Tool(
49
+ name="list_directory",
50
+ description="List files and directories in a path. Uses caching for faster repeated access.",
51
+ inputSchema={
52
+ "type": "object",
53
+ "properties": {
54
+ "path": {"type": "string", "description": "Directory path to list"}
55
+ },
56
+ "required": ["path"],
57
+ },
58
+ meta={"defer_loading": True},
59
+ ),
60
+ Tool(
61
+ name="read_file",
62
+ description=(
63
+ "Read the contents of a file. Supports smart truncation and log-awareness. "
64
+ "For log files (.log, .out, .err), defaults to reading the last 100 lines."
65
+ ),
66
+ inputSchema={
67
+ "type": "object",
68
+ "properties": {
69
+ "path": {"type": "string", "description": "Absolute or relative path to the file"},
70
+ "offset": {
71
+ "type": "integer",
72
+ "description": "Line number to start reading from (0-indexed)",
73
+ "default": 0
74
+ },
75
+ "limit": {
76
+ "type": "integer",
77
+ "description": "Maximum number of lines to read",
78
+ },
79
+ },
80
+ "required": ["path"],
81
+ },
82
+ meta={"defer_loading": True},
83
+ ),
84
+ Tool(
85
+ name="write_file",
86
+ description="Write content to a file. Invalidates related cache entries.",
87
+ inputSchema={
88
+ "type": "object",
89
+ "properties": {
90
+ "path": {"type": "string", "description": "Path to the file to write"},
91
+ "content": {"type": "string", "description": "Content to write to the file"},
92
+ },
93
+ "required": ["path", "content"],
94
+ },
95
+ meta={"defer_loading": True},
96
+ ),
97
+ Tool(
98
+ name="replace",
99
+ description="Replace text in a file. Invalidates related cache entries.",
100
+ inputSchema={
101
+ "type": "object",
102
+ "properties": {
103
+ "path": {"type": "string", "description": "Path to the file to modify"},
104
+ "old_string": {"type": "string", "description": "The exact literal text to replace"},
105
+ "new_string": {"type": "string", "description": "The exact literal text to replace with"},
106
+ "instruction": {"type": "string", "description": "Detailed description of the change"},
107
+ "expected_replacements": {
108
+ "type": "integer",
109
+ "description": "Number of replacements expected",
110
+ "default": 1
111
+ },
112
+ },
113
+ "required": ["path", "old_string", "new_string", "instruction"],
114
+ },
115
+ meta={"defer_loading": True},
116
+ ),
117
+ Tool(
118
+ name="run_shell_command",
119
+ description="Execute a shell command. Invalidates cache if it looks like a write operation.",
120
+ inputSchema={
121
+ "type": "object",
122
+ "properties": {
123
+ "command": {"type": "string", "description": "Exact bash command to execute"},
124
+ "description": {"type": "string", "description": "Brief description of the command's purpose"},
125
+ "dir_path": {"type": "string", "description": "Optional directory to run the command in"},
126
+ },
127
+ "required": ["command", "description"],
128
+ },
129
+ meta={"defer_loading": True},
23
130
  ),
24
131
  Tool(
25
132
  name="invoke_gemini",
@@ -76,6 +183,59 @@ def get_tool_definitions() -> List[Tool]:
76
183
  },
77
184
  },
78
185
  "required": ["prompt"],
186
+ },
187
+ meta={"defer_loading": True},
188
+ ),
189
+ Tool(
190
+ name="invoke_gemini_agentic",
191
+ description=(
192
+ "Invoke Gemini with function calling for agentic tasks. "
193
+ "Implements a multi-turn agentic loop: sends prompt with tool definitions, "
194
+ "executes tool calls, and iterates until final response or max_turns reached. "
195
+ "Supports both API key (GEMINI_API_KEY) and OAuth authentication."
196
+ ),
197
+ inputSchema={
198
+ "type": "object",
199
+ "properties": {
200
+ "prompt": {
201
+ "type": "string",
202
+ "description": "The task prompt for the agentic loop",
203
+ },
204
+ "model": {
205
+ "type": "string",
206
+ "description": "Gemini model to use (default: gemini-3-flash)",
207
+ "default": "gemini-3-flash",
208
+ },
209
+ "max_turns": {
210
+ "type": "integer",
211
+ "description": "Maximum number of tool-use turns (default: 10)",
212
+ "default": 10,
213
+ },
214
+ "timeout": {
215
+ "type": "integer",
216
+ "description": "Request timeout in seconds (default: 120)",
217
+ "default": 120,
218
+ },
219
+ "agent_context": {
220
+ "type": "object",
221
+ "description": "Optional agent metadata for logging (agent_type, task_id, description)",
222
+ "properties": {
223
+ "agent_type": {
224
+ "type": "string",
225
+ "description": "Type of agent (explore, delphi, frontend, etc.)",
226
+ },
227
+ "task_id": {
228
+ "type": "string",
229
+ "description": "Background task ID if running as agent",
230
+ },
231
+ "description": {
232
+ "type": "string",
233
+ "description": "Short description of what the agent is doing",
234
+ },
235
+ },
236
+ },
237
+ },
238
+ "required": ["prompt"],
79
239
  },
80
240
  ),
81
241
  Tool(
@@ -113,6 +273,12 @@ def get_tool_definitions() -> List[Tool]:
113
273
  "description": "Tokens reserved for internal reasoning (e.g. o1 / o3)",
114
274
  "default": 0,
115
275
  },
276
+ "reasoning_effort": {
277
+ "type": "string",
278
+ "description": "Reasoning effort for reasoning models (o1, o3): low, medium, high",
279
+ "enum": ["low", "medium", "high"],
280
+ "default": "medium",
281
+ },
116
282
  "agent_context": {
117
283
  "type": "object",
118
284
  "description": "Optional agent metadata for logging (agent_type, task_id, description)",
@@ -134,6 +300,7 @@ def get_tool_definitions() -> List[Tool]:
134
300
  },
135
301
  "required": ["prompt"],
136
302
  },
303
+ meta={"defer_loading": True},
137
304
  ),
138
305
  Tool(
139
306
  name="get_project_context",
@@ -144,6 +311,7 @@ def get_tool_definitions() -> List[Tool]:
144
311
  "project_path": {"type": "string", "description": "Path to the project root"},
145
312
  },
146
313
  },
314
+ meta={"defer_loading": True},
147
315
  ),
148
316
  Tool(
149
317
  name="get_system_health",
@@ -152,6 +320,7 @@ def get_tool_definitions() -> List[Tool]:
152
320
  "type": "object",
153
321
  "properties": {},
154
322
  },
323
+ meta={"defer_loading": True},
155
324
  ),
156
325
  Tool(
157
326
  name="lsp_diagnostics",
@@ -168,6 +337,7 @@ def get_tool_definitions() -> List[Tool]:
168
337
  },
169
338
  "required": ["file_path"],
170
339
  },
340
+ meta={"defer_loading": True},
171
341
  ),
172
342
  Tool(
173
343
  name="ast_grep_search",
@@ -229,6 +399,7 @@ def get_tool_definitions() -> List[Tool]:
229
399
  "limit": {"type": "integer", "description": "Max sessions", "default": 20},
230
400
  },
231
401
  },
402
+ meta={"defer_loading": True},
232
403
  ),
233
404
  Tool(
234
405
  name="session_read",
@@ -241,6 +412,7 @@ def get_tool_definitions() -> List[Tool]:
241
412
  },
242
413
  "required": ["session_id"],
243
414
  },
415
+ meta={"defer_loading": True},
244
416
  ),
245
417
  Tool(
246
418
  name="session_search",
@@ -254,6 +426,7 @@ def get_tool_definitions() -> List[Tool]:
254
426
  },
255
427
  "required": ["query"],
256
428
  },
429
+ meta={"defer_loading": True},
257
430
  ),
258
431
  Tool(
259
432
  name="skill_list",
@@ -264,6 +437,7 @@ def get_tool_definitions() -> List[Tool]:
264
437
  "project_path": {"type": "string", "description": "Project directory"},
265
438
  },
266
439
  },
440
+ meta={"defer_loading": True},
267
441
  ),
268
442
  Tool(
269
443
  name="skill_get",
@@ -276,6 +450,7 @@ def get_tool_definitions() -> List[Tool]:
276
450
  },
277
451
  "required": ["name"],
278
452
  },
453
+ meta={"defer_loading": True},
279
454
  ),
280
455
  Tool(
281
456
  name="task_spawn",
@@ -298,6 +473,7 @@ def get_tool_definitions() -> List[Tool]:
298
473
  },
299
474
  "required": ["prompt"],
300
475
  },
476
+ meta={"defer_loading": True},
301
477
  ),
302
478
  Tool(
303
479
  name="task_status",
@@ -309,6 +485,7 @@ def get_tool_definitions() -> List[Tool]:
309
485
  },
310
486
  "required": ["task_id"],
311
487
  },
488
+ meta={"defer_loading": True},
312
489
  ),
313
490
  Tool(
314
491
  name="task_list",
@@ -317,6 +494,7 @@ def get_tool_definitions() -> List[Tool]:
317
494
  "type": "object",
318
495
  "properties": {},
319
496
  },
497
+ meta={"defer_loading": True},
320
498
  ),
321
499
  Tool(
322
500
  name="agent_spawn",
@@ -384,6 +562,7 @@ def get_tool_definitions() -> List[Tool]:
384
562
  },
385
563
  "required": ["task_id"],
386
564
  },
565
+ meta={"defer_loading": True},
387
566
  ),
388
567
  Tool(
389
568
  name="agent_output",
@@ -411,14 +590,42 @@ def get_tool_definitions() -> List[Tool]:
411
590
  },
412
591
  "required": ["task_id"],
413
592
  },
593
+ meta={"defer_loading": True},
414
594
  ),
415
595
  Tool(
416
596
  name="agent_list",
417
- description="List all background agent tasks with their status.",
597
+ description="List all background agent tasks with their status. By default shows all agents; use show_all=false to see only running/pending.",
418
598
  inputSchema={
419
599
  "type": "object",
420
- "properties": {},
600
+ "properties": {
601
+ "show_all": {
602
+ "type": "boolean",
603
+ "description": "If false, only show running/pending agents. If true (default), show all.",
604
+ "default": True,
605
+ },
606
+ },
607
+ },
608
+ meta={"defer_loading": True},
609
+ ),
610
+ Tool(
611
+ name="agent_cleanup",
612
+ description="Clean up old completed/failed/cancelled agents to reduce clutter in agent_list. Removes agents older than max_age_minutes.",
613
+ inputSchema={
614
+ "type": "object",
615
+ "properties": {
616
+ "max_age_minutes": {
617
+ "type": "integer",
618
+ "description": "Remove agents older than this many minutes (default: 30)",
619
+ "default": 30,
620
+ },
621
+ "statuses": {
622
+ "type": "array",
623
+ "items": {"type": "string"},
624
+ "description": "List of statuses to remove (default: ['completed', 'failed', 'cancelled'])",
625
+ },
626
+ },
421
627
  },
628
+ meta={"defer_loading": True},
422
629
  ),
423
630
  Tool(
424
631
  name="agent_progress",
@@ -435,6 +642,7 @@ def get_tool_definitions() -> List[Tool]:
435
642
  },
436
643
  "required": ["task_id"],
437
644
  },
645
+ meta={"defer_loading": True},
438
646
  ),
439
647
  Tool(
440
648
  name="lsp_hover",
@@ -451,6 +659,7 @@ def get_tool_definitions() -> List[Tool]:
451
659
  },
452
660
  "required": ["file_path", "line", "character"],
453
661
  },
662
+ meta={"defer_loading": True},
454
663
  ),
455
664
  Tool(
456
665
  name="lsp_goto_definition",
@@ -467,6 +676,7 @@ def get_tool_definitions() -> List[Tool]:
467
676
  },
468
677
  "required": ["file_path", "line", "character"],
469
678
  },
679
+ meta={"defer_loading": True},
470
680
  ),
471
681
  Tool(
472
682
  name="lsp_find_references",
@@ -488,6 +698,7 @@ def get_tool_definitions() -> List[Tool]:
488
698
  },
489
699
  "required": ["file_path", "line", "character"],
490
700
  },
701
+ meta={"defer_loading": True},
491
702
  ),
492
703
  Tool(
493
704
  name="lsp_document_symbols",
@@ -499,6 +710,7 @@ def get_tool_definitions() -> List[Tool]:
499
710
  },
500
711
  "required": ["file_path"],
501
712
  },
713
+ meta={"defer_loading": True},
502
714
  ),
503
715
  Tool(
504
716
  name="lsp_workspace_symbols",
@@ -518,6 +730,7 @@ def get_tool_definitions() -> List[Tool]:
518
730
  },
519
731
  "required": ["query"],
520
732
  },
733
+ meta={"defer_loading": True},
521
734
  ),
522
735
  Tool(
523
736
  name="lsp_prepare_rename",
@@ -534,6 +747,7 @@ def get_tool_definitions() -> List[Tool]:
534
747
  },
535
748
  "required": ["file_path", "line", "character"],
536
749
  },
750
+ meta={"defer_loading": True},
537
751
  ),
538
752
  Tool(
539
753
  name="lsp_rename",
@@ -556,6 +770,7 @@ def get_tool_definitions() -> List[Tool]:
556
770
  },
557
771
  "required": ["file_path", "line", "character", "new_name"],
558
772
  },
773
+ meta={"defer_loading": True},
559
774
  ),
560
775
  Tool(
561
776
  name="lsp_code_actions",
@@ -572,6 +787,58 @@ def get_tool_definitions() -> List[Tool]:
572
787
  },
573
788
  "required": ["file_path", "line", "character"],
574
789
  },
790
+ meta={"defer_loading": True},
791
+ ),
792
+ Tool(
793
+ name="lsp_code_action_resolve",
794
+ description="Apply a specific code action/fix to a file (e.g., fix F401 unused import).",
795
+ inputSchema={
796
+ "type": "object",
797
+ "properties": {
798
+ "file_path": {"type": "string", "description": "Absolute path to the file"},
799
+ "action_code": {
800
+ "type": "string",
801
+ "description": "Code action ID to apply (e.g., 'F401', 'E501' for Python)",
802
+ },
803
+ "line": {
804
+ "type": "integer",
805
+ "description": "Optional line number filter (1-indexed)",
806
+ },
807
+ },
808
+ "required": ["file_path", "action_code"],
809
+ },
810
+ meta={"defer_loading": True},
811
+ ),
812
+ Tool(
813
+ name="lsp_extract_refactor",
814
+ description="Extract code to a function or variable (Python via jedi).",
815
+ inputSchema={
816
+ "type": "object",
817
+ "properties": {
818
+ "file_path": {"type": "string", "description": "Absolute path to the file"},
819
+ "start_line": {"type": "integer", "description": "Start line (1-indexed)"},
820
+ "start_char": {"type": "integer", "description": "Start character (0-indexed)"},
821
+ "end_line": {"type": "integer", "description": "End line (1-indexed)"},
822
+ "end_char": {"type": "integer", "description": "End character (0-indexed)"},
823
+ "new_name": {
824
+ "type": "string",
825
+ "description": "Name for extracted function/variable",
826
+ },
827
+ "kind": {
828
+ "type": "string",
829
+ "description": "'function' or 'variable' (default: function)",
830
+ },
831
+ },
832
+ "required": [
833
+ "file_path",
834
+ "start_line",
835
+ "start_char",
836
+ "end_line",
837
+ "end_char",
838
+ "new_name",
839
+ ],
840
+ },
841
+ meta={"defer_loading": True},
575
842
  ),
576
843
  Tool(
577
844
  name="lsp_servers",
@@ -580,6 +847,7 @@ def get_tool_definitions() -> List[Tool]:
580
847
  "type": "object",
581
848
  "properties": {},
582
849
  },
850
+ meta={"defer_loading": True},
583
851
  ),
584
852
  Tool(
585
853
  name="ast_grep_replace",
@@ -612,11 +880,475 @@ def get_tool_definitions() -> List[Tool]:
612
880
  },
613
881
  "required": ["pattern", "replacement"],
614
882
  },
883
+ meta={"defer_loading": True},
884
+ ),
885
+ # --- SEMANTIC SEARCH ---
886
+ Tool(
887
+ name="semantic_search",
888
+ description=(
889
+ "Search codebase using natural language queries. Uses vector embeddings to find "
890
+ "semantically related code even without exact pattern matches. "
891
+ "Supports filtering by language and node type. "
892
+ "Example: 'find authentication logic' or 'error handling patterns'."
893
+ ),
894
+ inputSchema={
895
+ "type": "object",
896
+ "properties": {
897
+ "query": {
898
+ "type": "string",
899
+ "description": "Natural language search query (e.g., 'find authentication logic')",
900
+ },
901
+ "project_path": {
902
+ "type": "string",
903
+ "description": "Path to the project root",
904
+ "default": ".",
905
+ },
906
+ "n_results": {
907
+ "type": "integer",
908
+ "description": "Maximum number of results to return",
909
+ "default": 10,
910
+ },
911
+ "language": {
912
+ "type": "string",
913
+ "description": "Filter by language (e.g., 'py', 'ts', 'js')",
914
+ },
915
+ "node_type": {
916
+ "type": "string",
917
+ "description": "Filter by node type (e.g., 'function', 'class', 'method')",
918
+ },
919
+ "provider": {
920
+ "type": "string",
921
+ "description": "Embedding provider: ollama/mxbai (local/free), gemini (cloud/OAuth), openai (cloud/OAuth), huggingface (cloud)",
922
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
923
+ "default": "ollama",
924
+ },
925
+ },
926
+ "required": ["query"],
927
+ },
928
+ meta={"defer_loading": True},
929
+ ),
930
+ Tool(
931
+ name="hybrid_search",
932
+ description=(
933
+ "Hybrid search combining semantic similarity with structural AST matching. "
934
+ "Use when you need both natural language understanding AND structural patterns. "
935
+ "Example: query='find authentication logic' + pattern='def $FUNC($$$):'"
936
+ ),
937
+ inputSchema={
938
+ "type": "object",
939
+ "properties": {
940
+ "query": {
941
+ "type": "string",
942
+ "description": "Natural language search query",
943
+ },
944
+ "pattern": {
945
+ "type": "string",
946
+ "description": "ast-grep pattern for structural matching (optional)",
947
+ },
948
+ "project_path": {
949
+ "type": "string",
950
+ "description": "Path to the project root",
951
+ "default": ".",
952
+ },
953
+ "n_results": {
954
+ "type": "integer",
955
+ "description": "Maximum number of results to return",
956
+ "default": 10,
957
+ },
958
+ "language": {
959
+ "type": "string",
960
+ "description": "Filter by language (e.g., 'py', 'ts', 'js')",
961
+ },
962
+ "node_type": {
963
+ "type": "string",
964
+ "description": "Filter by node type (e.g., 'function', 'class', 'method')",
965
+ },
966
+ "decorator": {
967
+ "type": "string",
968
+ "description": "Filter by decorator (e.g., '@property', '@staticmethod')",
969
+ },
970
+ "is_async": {
971
+ "type": "boolean",
972
+ "description": "Filter by async status (True = async only, False = sync only)",
973
+ },
974
+ "base_class": {
975
+ "type": "string",
976
+ "description": "Filter by base class (e.g., 'BaseClass')",
977
+ },
978
+ "provider": {
979
+ "type": "string",
980
+ "description": "Embedding provider: ollama/mxbai (local/free), gemini (cloud/OAuth), openai (cloud/OAuth), huggingface (cloud)",
981
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
982
+ "default": "ollama",
983
+ },
984
+ },
985
+ "required": ["query"],
986
+ },
987
+ meta={"defer_loading": True},
988
+ ),
989
+ Tool(
990
+ name="find_code",
991
+ description=(
992
+ "Smart code search with automatic routing to optimal search strategy. "
993
+ "Automatically detects whether query is AST pattern (e.g., 'class $X'), "
994
+ "natural language (e.g., 'auth logic'), or complex query (e.g., 'JWT AND middleware'). "
995
+ "Routes to ast_grep, semantic_search, hybrid_search, or grep based on pattern detection. "
996
+ "**PREFERRED TOOL**: Use this instead of calling individual search tools directly."
997
+ ),
998
+ inputSchema={
999
+ "type": "object",
1000
+ "properties": {
1001
+ "query": {
1002
+ "type": "string",
1003
+ "description": "Search query (AST pattern, natural language, or text)",
1004
+ },
1005
+ "search_type": {
1006
+ "type": "string",
1007
+ "description": "Search strategy: 'auto' (default), 'ast', 'semantic', 'hybrid', 'grep', 'exact'",
1008
+ "enum": ["auto", "ast", "semantic", "hybrid", "grep", "exact"],
1009
+ "default": "auto",
1010
+ },
1011
+ "project_path": {
1012
+ "type": "string",
1013
+ "description": "Path to the project root",
1014
+ "default": ".",
1015
+ },
1016
+ "language": {
1017
+ "type": "string",
1018
+ "description": "Filter by language (e.g., 'py', 'ts', 'js')",
1019
+ },
1020
+ "n_results": {
1021
+ "type": "integer",
1022
+ "description": "Maximum number of results to return",
1023
+ "default": 10,
1024
+ },
1025
+ "provider": {
1026
+ "type": "string",
1027
+ "description": "Embedding provider for semantic search: ollama (default), gemini, openai",
1028
+ "default": "ollama",
1029
+ },
1030
+ },
1031
+ "required": ["query"],
1032
+ },
1033
+ meta={"defer_loading": True},
1034
+ ),
1035
+ Tool(
1036
+ name="semantic_index",
1037
+ description=(
1038
+ "Index a codebase for semantic search. Creates vector embeddings for all code files. "
1039
+ "Run this before using semantic_search on a new project."
1040
+ ),
1041
+ inputSchema={
1042
+ "type": "object",
1043
+ "properties": {
1044
+ "project_path": {
1045
+ "type": "string",
1046
+ "description": "Path to the project root",
1047
+ "default": ".",
1048
+ },
1049
+ "force": {
1050
+ "type": "boolean",
1051
+ "description": "If true, reindex everything. Otherwise, only new/changed files.",
1052
+ "default": False,
1053
+ },
1054
+ "provider": {
1055
+ "type": "string",
1056
+ "description": "Embedding provider: ollama/mxbai (local/free), gemini (cloud/OAuth), openai (cloud/OAuth), huggingface (cloud)",
1057
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
1058
+ "default": "ollama",
1059
+ },
1060
+ },
1061
+ },
1062
+ meta={"defer_loading": True},
1063
+ ),
1064
+ Tool(
1065
+ name="semantic_stats",
1066
+ description="Get statistics about the semantic search index for a project.",
1067
+ inputSchema={
1068
+ "type": "object",
1069
+ "properties": {
1070
+ "project_path": {
1071
+ "type": "string",
1072
+ "description": "Path to the project root",
1073
+ "default": ".",
1074
+ },
1075
+ "provider": {
1076
+ "type": "string",
1077
+ "description": "Embedding provider: ollama/mxbai (local/free), gemini (cloud/OAuth), openai (cloud/OAuth), huggingface (cloud)",
1078
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
1079
+ "default": "ollama",
1080
+ },
1081
+ },
1082
+ },
1083
+ meta={"defer_loading": True},
1084
+ ),
1085
+ Tool(
1086
+ name="start_file_watcher",
1087
+ description=(
1088
+ "Start automatic background reindexing when code files change. "
1089
+ "Watches for .py file changes and triggers semantic_index automatically. "
1090
+ "Run semantic_index() first before starting the watcher."
1091
+ ),
1092
+ inputSchema={
1093
+ "type": "object",
1094
+ "properties": {
1095
+ "project_path": {
1096
+ "type": "string",
1097
+ "description": "Path to the project root",
1098
+ "default": ".",
1099
+ },
1100
+ "provider": {
1101
+ "type": "string",
1102
+ "description": "Embedding provider: ollama/mxbai (local/free), gemini (cloud/OAuth), openai (cloud/OAuth), huggingface (cloud)",
1103
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
1104
+ "default": "ollama",
1105
+ },
1106
+ "debounce_seconds": {
1107
+ "type": "number",
1108
+ "description": "Wait time after file changes before reindexing (default: 2.0)",
1109
+ "default": 2.0,
1110
+ },
1111
+ },
1112
+ },
1113
+ meta={"defer_loading": True},
1114
+ ),
1115
+ Tool(
1116
+ name="stop_file_watcher",
1117
+ description="Stop the file watcher for a project.",
1118
+ inputSchema={
1119
+ "type": "object",
1120
+ "properties": {
1121
+ "project_path": {
1122
+ "type": "string",
1123
+ "description": "Path to the project root",
1124
+ "default": ".",
1125
+ },
1126
+ },
1127
+ },
1128
+ meta={"defer_loading": True},
1129
+ ),
1130
+ Tool(
1131
+ name="cancel_indexing",
1132
+ description=(
1133
+ "Cancel an ongoing semantic indexing operation. "
1134
+ "Cancellation happens gracefully between batches - the current batch will complete before stopping."
1135
+ ),
1136
+ inputSchema={
1137
+ "type": "object",
1138
+ "properties": {
1139
+ "project_path": {
1140
+ "type": "string",
1141
+ "description": "Path to the project root",
1142
+ "default": ".",
1143
+ },
1144
+ "provider": {
1145
+ "type": "string",
1146
+ "description": "Embedding provider (must match the one used for indexing)",
1147
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
1148
+ "default": "ollama",
1149
+ },
1150
+ },
1151
+ },
1152
+ meta={"defer_loading": True},
1153
+ ),
1154
+ Tool(
1155
+ name="delete_index",
1156
+ description=(
1157
+ "Delete semantic search index(es). Can delete for specific project+provider, "
1158
+ "all providers for a project, or all indexes globally."
1159
+ ),
1160
+ inputSchema={
1161
+ "type": "object",
1162
+ "properties": {
1163
+ "project_path": {
1164
+ "type": "string",
1165
+ "description": "Path to the project root (ignored if delete_all=true)",
1166
+ "default": ".",
1167
+ },
1168
+ "provider": {
1169
+ "type": "string",
1170
+ "description": "Specific provider to delete (if not specified, deletes all providers for project)",
1171
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
1172
+ },
1173
+ "delete_all": {
1174
+ "type": "boolean",
1175
+ "description": "If true, delete ALL indexes for ALL projects (ignores project_path and provider)",
1176
+ "default": False,
1177
+ },
1178
+ },
1179
+ },
1180
+ meta={"defer_loading": True},
1181
+ ),
1182
+ Tool(
1183
+ name="list_file_watchers",
1184
+ description="List all active file watchers across all projects.",
1185
+ inputSchema={
1186
+ "type": "object",
1187
+ "properties": {},
1188
+ },
1189
+ meta={"defer_loading": True},
1190
+ ),
1191
+ Tool(
1192
+ name="multi_query_search",
1193
+ description=(
1194
+ "Search with LLM-expanded query variations for better recall. "
1195
+ "Rephrases query into multiple semantic variations (e.g., 'database connection' -> "
1196
+ "['SQLAlchemy engine setup', 'postgres connection', 'db session factory']) "
1197
+ "and aggregates results using reciprocal rank fusion."
1198
+ ),
1199
+ inputSchema={
1200
+ "type": "object",
1201
+ "properties": {
1202
+ "query": {
1203
+ "type": "string",
1204
+ "description": "Natural language search query",
1205
+ },
1206
+ "project_path": {
1207
+ "type": "string",
1208
+ "description": "Path to the project root",
1209
+ "default": ".",
1210
+ },
1211
+ "n_results": {
1212
+ "type": "integer",
1213
+ "description": "Maximum number of results to return",
1214
+ "default": 10,
1215
+ },
1216
+ "num_expansions": {
1217
+ "type": "integer",
1218
+ "description": "Number of query variations to generate",
1219
+ "default": 3,
1220
+ },
1221
+ "language": {
1222
+ "type": "string",
1223
+ "description": "Filter by language (e.g., 'py', 'ts')",
1224
+ },
1225
+ "node_type": {
1226
+ "type": "string",
1227
+ "description": "Filter by node type (e.g., 'function', 'class')",
1228
+ },
1229
+ "provider": {
1230
+ "type": "string",
1231
+ "description": "Embedding provider: ollama/mxbai (local/free), gemini (cloud/OAuth), openai (cloud/OAuth), huggingface (cloud)",
1232
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
1233
+ "default": "ollama",
1234
+ },
1235
+ },
1236
+ "required": ["query"],
1237
+ },
1238
+ meta={"defer_loading": True},
1239
+ ),
1240
+ Tool(
1241
+ name="decomposed_search",
1242
+ description=(
1243
+ "Search by decomposing complex queries into focused sub-questions. "
1244
+ "Breaks multi-part queries like 'Initialize the DB and create a user model' "
1245
+ "into separate searches ('database initialization', 'user model definition') "
1246
+ "and returns organized results for each part."
1247
+ ),
1248
+ inputSchema={
1249
+ "type": "object",
1250
+ "properties": {
1251
+ "query": {
1252
+ "type": "string",
1253
+ "description": "Complex search query (may contain multiple concepts)",
1254
+ },
1255
+ "project_path": {
1256
+ "type": "string",
1257
+ "description": "Path to the project root",
1258
+ "default": ".",
1259
+ },
1260
+ "n_results": {
1261
+ "type": "integer",
1262
+ "description": "Maximum results per sub-query",
1263
+ "default": 10,
1264
+ },
1265
+ "language": {
1266
+ "type": "string",
1267
+ "description": "Filter by language",
1268
+ },
1269
+ "node_type": {
1270
+ "type": "string",
1271
+ "description": "Filter by node type",
1272
+ },
1273
+ "provider": {
1274
+ "type": "string",
1275
+ "description": "Embedding provider: ollama/mxbai (local/free), gemini (cloud/OAuth), openai (cloud/OAuth), huggingface (cloud)",
1276
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
1277
+ "default": "ollama",
1278
+ },
1279
+ },
1280
+ "required": ["query"],
1281
+ },
1282
+ meta={"defer_loading": True},
1283
+ ),
1284
+ Tool(
1285
+ name="enhanced_search",
1286
+ description=(
1287
+ "Unified enhanced search combining query expansion and decomposition. "
1288
+ "Automatically selects strategy based on query complexity: "
1289
+ "simple queries use multi-query expansion, complex queries use decomposition. "
1290
+ "Use mode='auto' (default), 'expand', 'decompose', or 'both'."
1291
+ ),
1292
+ inputSchema={
1293
+ "type": "object",
1294
+ "properties": {
1295
+ "query": {
1296
+ "type": "string",
1297
+ "description": "Search query (simple or complex)",
1298
+ },
1299
+ "project_path": {
1300
+ "type": "string",
1301
+ "description": "Path to the project root",
1302
+ "default": ".",
1303
+ },
1304
+ "n_results": {
1305
+ "type": "integer",
1306
+ "description": "Maximum number of results",
1307
+ "default": 10,
1308
+ },
1309
+ "mode": {
1310
+ "type": "string",
1311
+ "description": "Search mode: 'auto' (default), 'expand', 'decompose', or 'both'",
1312
+ "enum": ["auto", "expand", "decompose", "both"],
1313
+ "default": "auto",
1314
+ },
1315
+ "language": {
1316
+ "type": "string",
1317
+ "description": "Filter by language",
1318
+ },
1319
+ "node_type": {
1320
+ "type": "string",
1321
+ "description": "Filter by node type",
1322
+ },
1323
+ "provider": {
1324
+ "type": "string",
1325
+ "description": "Embedding provider: ollama/mxbai (local/free), gemini (cloud/OAuth), openai (cloud/OAuth), huggingface (cloud)",
1326
+ "enum": ["ollama", "mxbai", "gemini", "openai", "huggingface"],
1327
+ "default": "ollama",
1328
+ },
1329
+ },
1330
+ "required": ["query"],
1331
+ },
1332
+ meta={"defer_loading": True},
1333
+ ),
1334
+ Tool(
1335
+ name="get_cost_report",
1336
+ description="Get a cost report for the current or specified session, breaking down token usage and cost by agent.",
1337
+ inputSchema={
1338
+ "type": "object",
1339
+ "properties": {
1340
+ "session_id": {
1341
+ "type": "string",
1342
+ "description": "Optional session ID to filter by",
1343
+ },
1344
+ },
1345
+ },
1346
+ meta={"defer_loading": True},
615
1347
  ),
616
1348
  ]
617
1349
 
618
1350
 
619
- def get_prompt_definitions() -> List[Prompt]:
1351
+ def get_prompt_definitions() -> list[Prompt]:
620
1352
  """Return all Prompt definitions for the Stravinsky MCP server."""
621
1353
  return [
622
1354
  Prompt(