1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
//! Additional extended tool definitions for the registry.
//!
//! Core tools are defined in `builder_core.rs`. Both files extracted
//! from `definitions.rs` to maintain the ≤500 LOC invariant.
use crate::types::Tool;
use serde_json::json;
/// Create additional extended tools from tool_definitions.rs
/// These tools are loaded on-demand and not in the core set
pub(super) fn create_additional_extended_tools() -> Vec<Tool> {
vec![
// Advanced pattern analysis tool
crate::mcp::tools::advanced_pattern_analysis::AdvancedPatternAnalysisTool::tool_definition(
),
// Quality metrics tool
crate::mcp::tools::quality_metrics::QualityMetricsTool::tool_definition(),
// Embedding configuration and query tools
crate::mcp::tools::embeddings::configure_embeddings_tool(),
crate::mcp::tools::embeddings::query_semantic_memory_tool(),
crate::mcp::tools::embeddings::test_embeddings_tool(),
// New embedding tools
crate::mcp::tools::embeddings::generate_embedding_tool(),
crate::mcp::tools::embeddings::search_by_embedding_tool(),
crate::mcp::tools::embeddings::embedding_provider_status_tool(),
// External signal provider tools
crate::mcp::tools::external_signals::configure_agentfs_tool(),
crate::mcp::tools::external_signals::external_signal_status_tool(),
crate::mcp::tools::external_signals::test_agentfs_connection_tool(),
// Pattern search tool
Tool::new(
"search_patterns".to_string(),
"Search for patterns semantically similar to a query using multi-signal ranking"
.to_string(),
json!({
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Natural language query describing what pattern to search for"
},
"domain": {
"type": "string",
"description": "Domain to search in (e.g., 'web-api', 'cli', 'data-processing')"
},
"tags": {
"type": "array",
"items": {"type": "string"},
"maxItems": 100,
"description": "Optional tags for filtering (max 100)",
"default": []
},
"limit": {
"type": "integer",
"description": "Maximum number of results (default: 5)",
"default": 5,
"minimum": 1,
"maximum": 100
},
"min_relevance": {
"type": "number",
"description": "Minimum relevance score 0.0-1.0 (default: 0.3)",
"default": 0.3
},
"filter_by_domain": {
"type": "boolean",
"description": "Whether to filter by domain (default: false)",
"default": false
}
},
"required": ["query", "domain"]
}),
),
// Pattern recommendation tools (shared constructors so both registries
// expose textually identical schemas, ADR-080 attribution surface)
crate::server::recommendation_tool_definitions::recommend_patterns_tool(),
// ADR-044 Feature 1: Playbook recommendation tool
crate::server::recommendation_tool_definitions::recommend_playbook_tool(),
// ADR-044 Feature 1: Pattern explanation tool
Tool::new(
"explain_pattern".to_string(),
"Get a human-readable explanation of a pattern including when to use it and expected outcomes"
.to_string(),
json!({
"type": "object",
"properties": {
"pattern_id": {
"type": "string",
"description": "UUID of the pattern to explain",
"format": "uuid"
}
},
"required": ["pattern_id"]
}),
),
// ADR-044 Feature 2: Recommendation feedback tools
Tool::new(
"record_recommendation_session".to_string(),
"Record a recommendation session when patterns/playbooks are suggested to an agent"
.to_string(),
json!({
"type": "object",
"properties": {
"episode_id": {
"type": "string",
"description": "Episode ID for which recommendations are made"
},
"recommended_pattern_ids": {
"type": "array",
"items": {"type": "string"},
"maxItems": 1000,
"description": "Pattern IDs that were recommended (max 1000)",
"default": []
},
"recommended_playbook_ids": {
"type": "array",
"items": {"type": "string"},
"maxItems": 1000,
"description": "Playbook IDs that were recommended (max 1000)",
"default": []
}
},
"required": ["episode_id"]
}),
),
Tool::new(
"record_recommendation_feedback".to_string(),
"Record feedback about which recommendations were used and the outcome".to_string(),
json!({
"type": "object",
"properties": {
"session_id": {
"type": "string",
"description": "Session ID from the recommendation session"
},
"applied_pattern_ids": {
"type": "array",
"items": {"type": "string"},
"maxItems": 1000,
"description": "Pattern IDs that were actually applied (max 1000)",
"default": []
},
"consulted_episode_ids": {
"type": "array",
"items": {"type": "string"},
"maxItems": 1000,
"description": "Episode IDs that were consulted (max 1000)",
"default": []
},
"outcome": {
"type": "object",
"description": "Final outcome of the task",
"properties": {
"type": {
"type": "string",
"enum": ["success", "partial_success", "failure"]
},
"verdict": {"type": "string"},
"reason": {"type": "string"},
"artifacts": {
"type": "array",
"items": {"type": "string"},
"default": []
}
},
"required": ["type"]
},
"agent_rating": {
"type": "number",
"description": "Optional rating of recommendation quality (0.0-1.0)",
"minimum": 0.0,
"maximum": 1.0
}
},
"required": ["session_id", "outcome"]
}),
),
Tool::new(
"get_recommendation_stats".to_string(),
"Get statistics about recommendation effectiveness and adoption rates".to_string(),
json!({
"type": "object",
"properties": {}
}),
),
// ADR-044 Feature 3: Checkpoint tools
crate::mcp::tools::checkpoint::CheckpointTools::checkpoint_episode_tool(),
crate::mcp::tools::checkpoint::CheckpointTools::get_handoff_pack_tool(),
crate::mcp::tools::checkpoint::CheckpointTools::resume_from_handoff_tool(),
crate::mcp::tools::checkpoint::CheckpointTools::resume_from_compact_tool(),
]
}