taurusdb-mcp 0.1.0

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 (44) hide show
  1. package/README.md +32 -0
  2. package/dist/commands/init.d.ts +1 -0
  3. package/dist/commands/init.js +195 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +22 -0
  6. package/dist/server.d.ts +12 -0
  7. package/dist/server.js +60 -0
  8. package/dist/tools/common/input.d.ts +50 -0
  9. package/dist/tools/common/input.js +168 -0
  10. package/dist/tools/common/public-formatters.d.ts +344 -0
  11. package/dist/tools/common/public-formatters.js +348 -0
  12. package/dist/tools/common.d.ts +2 -0
  13. package/dist/tools/common.js +2 -0
  14. package/dist/tools/discovery.d.ts +5 -0
  15. package/dist/tools/discovery.js +113 -0
  16. package/dist/tools/error-handling.d.ts +10 -0
  17. package/dist/tools/error-handling.js +122 -0
  18. package/dist/tools/ping.d.ts +4 -0
  19. package/dist/tools/ping.js +13 -0
  20. package/dist/tools/processlist.d.ts +2 -0
  21. package/dist/tools/processlist.js +121 -0
  22. package/dist/tools/query.d.ts +4 -0
  23. package/dist/tools/query.js +224 -0
  24. package/dist/tools/registry.d.ts +22 -0
  25. package/dist/tools/registry.js +106 -0
  26. package/dist/tools/taurus/capability.d.ts +3 -0
  27. package/dist/tools/taurus/capability.js +66 -0
  28. package/dist/tools/taurus/cloud-context.d.ts +4 -0
  29. package/dist/tools/taurus/cloud-context.js +209 -0
  30. package/dist/tools/taurus/cloud-instances.d.ts +2 -0
  31. package/dist/tools/taurus/cloud-instances.js +73 -0
  32. package/dist/tools/taurus/diagnostics.d.ts +9 -0
  33. package/dist/tools/taurus/diagnostics.js +323 -0
  34. package/dist/tools/taurus/explain.d.ts +2 -0
  35. package/dist/tools/taurus/explain.js +69 -0
  36. package/dist/tools/taurus/flashback.d.ts +2 -0
  37. package/dist/tools/taurus/flashback.js +101 -0
  38. package/dist/tools/taurus/recycle-bin.d.ts +3 -0
  39. package/dist/tools/taurus/recycle-bin.js +148 -0
  40. package/dist/utils/formatter.d.ts +5 -0
  41. package/dist/utils/formatter.js +8 -0
  42. package/dist/version.d.ts +1 -0
  43. package/dist/version.js +1 -0
  44. package/package.json +40 -0
@@ -0,0 +1,344 @@
1
+ import type { DbHotspotResult, DataSourceInfo, DatabaseInfo, DiagnosticResult, EnhancedExplainResult, ExplainResult, FeatureMatrix, FindTopSlowSqlResult, GuardrailDecision, KernelInfo, MutationResult, QueryResult, ServiceLatencyResult, TableInfo, TableSchema } from "taurusdb-core";
2
+ export declare function toPublicDataSourceInfo(info: DataSourceInfo): {
3
+ name: string;
4
+ engine: import("taurusdb-core").DatabaseEngine;
5
+ host: string | undefined;
6
+ port: number;
7
+ database: string | undefined;
8
+ has_mutation_user: boolean;
9
+ pool_size: number | undefined;
10
+ is_default: boolean;
11
+ };
12
+ export declare function toPublicDatabaseInfo(info: DatabaseInfo): {
13
+ name: string;
14
+ owner: string | undefined;
15
+ comment: string | undefined;
16
+ };
17
+ export declare function toPublicTableInfo(info: TableInfo): {
18
+ database: string;
19
+ name: string;
20
+ type: "table" | "view" | "materialized_view" | undefined;
21
+ comment: string | undefined;
22
+ row_count_estimate: number | undefined;
23
+ };
24
+ export declare function toPublicTableSchema(schema: TableSchema): {
25
+ database: string;
26
+ table: string;
27
+ columns: {
28
+ name: string;
29
+ data_type: string;
30
+ nullable: boolean;
31
+ default_value: unknown;
32
+ max_length: number | undefined;
33
+ is_primary_key: boolean | undefined;
34
+ is_indexed: boolean | undefined;
35
+ comment: string | undefined;
36
+ }[];
37
+ indexes: {
38
+ name: string;
39
+ columns: string[];
40
+ unique: boolean;
41
+ type: string | undefined;
42
+ }[];
43
+ primary_key: string[] | undefined;
44
+ engine_hints: {
45
+ likely_time_columns: string[];
46
+ likely_filter_columns: string[];
47
+ sensitive_columns: string[];
48
+ } | undefined;
49
+ comment: string | undefined;
50
+ row_count_estimate: number | undefined;
51
+ };
52
+ export declare function toPublicQueryResult(result: QueryResult): {
53
+ columns: import("taurusdb-core/executor/types").ColumnMeta[];
54
+ rows: unknown[][];
55
+ row_count: number;
56
+ original_row_count: number;
57
+ truncated: boolean;
58
+ row_truncated: boolean;
59
+ column_truncated: boolean;
60
+ field_truncated: boolean;
61
+ redacted_columns: string[];
62
+ dropped_columns: string[];
63
+ truncated_columns: string[];
64
+ };
65
+ export declare function toPublicMutationResult(result: MutationResult): {
66
+ affected_rows: number;
67
+ };
68
+ export declare function toPublicGuardrailDecision(decision: GuardrailDecision): {
69
+ action: "allow" | "confirm" | "block";
70
+ risk_level: import("taurusdb-core").RiskLevel;
71
+ reason_codes: string[];
72
+ risk_hints: string[];
73
+ requires_explain: boolean;
74
+ requires_confirmation: boolean;
75
+ sql_hash: string;
76
+ runtime_limits: {
77
+ readonly: boolean;
78
+ timeout_ms: number;
79
+ max_rows: number;
80
+ max_columns: number;
81
+ max_field_chars: number;
82
+ };
83
+ };
84
+ export declare function toPublicExplainResult(result: ExplainResult, decision: GuardrailDecision): {
85
+ plan: Record<string, unknown>[];
86
+ risk_summary: {
87
+ full_table_scan_likely: boolean;
88
+ index_hit_likely: boolean;
89
+ estimated_rows: number | null;
90
+ uses_temp_structure: boolean;
91
+ uses_filesort: boolean;
92
+ risk_hints: string[];
93
+ };
94
+ recommendations: string[];
95
+ guardrail: {
96
+ action: "allow" | "confirm" | "block";
97
+ risk_level: import("taurusdb-core").RiskLevel;
98
+ reason_codes: string[];
99
+ risk_hints: string[];
100
+ requires_explain: boolean;
101
+ requires_confirmation: boolean;
102
+ sql_hash: string;
103
+ runtime_limits: {
104
+ readonly: boolean;
105
+ timeout_ms: number;
106
+ max_rows: number;
107
+ max_columns: number;
108
+ max_field_chars: number;
109
+ };
110
+ };
111
+ };
112
+ export declare function toPublicKernelInfo(info: KernelInfo): {
113
+ is_taurusdb: boolean;
114
+ kernel_version: string | undefined;
115
+ mysql_compat: "unknown" | "5.7" | "8.0";
116
+ instance_spec_hint: "small" | "medium" | "large" | undefined;
117
+ raw_version: string;
118
+ };
119
+ export declare function toPublicFeatureMatrix(features: FeatureMatrix): {
120
+ [k: string]: {
121
+ [k: string]: unknown;
122
+ };
123
+ };
124
+ export declare function toPublicEnhancedExplainResult(result: EnhancedExplainResult, decision: GuardrailDecision): {
125
+ standard_plan: {
126
+ plan: Record<string, unknown>[];
127
+ risk_summary: {
128
+ full_table_scan_likely: boolean;
129
+ index_hit_likely: boolean;
130
+ estimated_rows: number | null;
131
+ uses_temp_structure: boolean;
132
+ uses_filesort: boolean;
133
+ risk_hints: string[];
134
+ };
135
+ recommendations: string[];
136
+ guardrail: {
137
+ action: "allow" | "confirm" | "block";
138
+ risk_level: import("taurusdb-core").RiskLevel;
139
+ reason_codes: string[];
140
+ risk_hints: string[];
141
+ requires_explain: boolean;
142
+ requires_confirmation: boolean;
143
+ sql_hash: string;
144
+ runtime_limits: {
145
+ readonly: boolean;
146
+ timeout_ms: number;
147
+ max_rows: number;
148
+ max_columns: number;
149
+ max_field_chars: number;
150
+ };
151
+ };
152
+ };
153
+ tree_plan: string | undefined;
154
+ taurus_hints: {
155
+ ndp_pushdown: {
156
+ condition: boolean;
157
+ columns: boolean;
158
+ aggregate: boolean;
159
+ blocked_reason: string | undefined;
160
+ };
161
+ parallel_query: {
162
+ would_enable: boolean;
163
+ estimated_degree: number | undefined;
164
+ blocked_reason: string | undefined;
165
+ };
166
+ offset_pushdown: boolean;
167
+ };
168
+ feature_explanations: {
169
+ ndp_pushdown: {
170
+ matched: boolean;
171
+ meaning: string;
172
+ why_triggered: string;
173
+ expected_benefit: string;
174
+ };
175
+ parallel_query: {
176
+ matched: boolean;
177
+ meaning: string;
178
+ why_triggered: string;
179
+ expected_benefit: string;
180
+ };
181
+ offset_pushdown: {
182
+ matched: boolean;
183
+ meaning: string;
184
+ why_triggered: string;
185
+ expected_benefit: string;
186
+ };
187
+ };
188
+ optimization_suggestions: string[];
189
+ };
190
+ export declare function toPublicDiagnosticResult(result: DiagnosticResult): {
191
+ tool: import("taurusdb-core").DiagnosticToolName;
192
+ status: import("taurusdb-core").DiagnosticStatus;
193
+ severity: import("taurusdb-core").DiagnosticSeverity;
194
+ summary: string;
195
+ diagnosis_window: {
196
+ from: string | undefined;
197
+ to: string | undefined;
198
+ relative: string | undefined;
199
+ };
200
+ root_cause_candidates: {
201
+ code: string;
202
+ title: string;
203
+ confidence: import("taurusdb-core").DiagnosticConfidence;
204
+ rationale: string;
205
+ }[];
206
+ key_findings: string[];
207
+ suspicious_entities: {
208
+ sqls: {
209
+ sql_hash: string | undefined;
210
+ digest_text: string | undefined;
211
+ reason: string;
212
+ }[] | undefined;
213
+ sessions: {
214
+ session_id: string | undefined;
215
+ user: string | undefined;
216
+ state: string | undefined;
217
+ reason: string;
218
+ }[] | undefined;
219
+ tables: {
220
+ table: string;
221
+ reason: string;
222
+ }[] | undefined;
223
+ users: {
224
+ user: string;
225
+ client_host: string | undefined;
226
+ reason: string;
227
+ }[] | undefined;
228
+ } | undefined;
229
+ evidence: {
230
+ source: string;
231
+ title: string;
232
+ summary: string;
233
+ raw_ref: string | undefined;
234
+ }[];
235
+ recommended_actions: string[];
236
+ recommended_next_tools: string[] | undefined;
237
+ next_tool_inputs: {
238
+ tool: import("taurusdb-core").DiagnosticToolName | "show_processlist";
239
+ input: Record<string, unknown>;
240
+ rationale: string;
241
+ }[] | undefined;
242
+ limitations: string[] | undefined;
243
+ };
244
+ export declare function toPublicTopSlowSqlResult(result: FindTopSlowSqlResult): {
245
+ tool: "find_top_slow_sql";
246
+ status: import("taurusdb-core").DiagnosticStatus;
247
+ summary: string;
248
+ diagnosis_window: {
249
+ from: string | undefined;
250
+ to: string | undefined;
251
+ relative: string | undefined;
252
+ };
253
+ top_sqls: {
254
+ sql_hash: string | undefined;
255
+ digest_text: string | undefined;
256
+ sample_sql: string | undefined;
257
+ avg_latency_ms: number | undefined;
258
+ total_latency_ms: number | undefined;
259
+ exec_count: number | undefined;
260
+ avg_lock_time_ms: number | undefined;
261
+ avg_rows_examined: number | undefined;
262
+ evidence_sources: string[];
263
+ recommendation: string | undefined;
264
+ }[];
265
+ evidence: {
266
+ source: string;
267
+ title: string;
268
+ summary: string;
269
+ raw_ref: string | undefined;
270
+ }[];
271
+ limitations: string[] | undefined;
272
+ };
273
+ export declare function toPublicServiceLatencyResult(result: ServiceLatencyResult): {
274
+ tool: "diagnose_service_latency";
275
+ status: import("taurusdb-core").DiagnosticStatus;
276
+ summary: string;
277
+ diagnosis_window: {
278
+ from: string | undefined;
279
+ to: string | undefined;
280
+ relative: string | undefined;
281
+ };
282
+ suspected_category: import("taurusdb-core").ServiceLatencySuspectedCategory;
283
+ top_candidates: {
284
+ type: "table" | "sql" | "session";
285
+ title: string;
286
+ confidence: import("taurusdb-core").DiagnosticConfidence;
287
+ sql_hash: string | undefined;
288
+ digest_text: string | undefined;
289
+ sample_sql: string | undefined;
290
+ session_id: string | undefined;
291
+ table: string | undefined;
292
+ rationale: string;
293
+ }[];
294
+ evidence: {
295
+ source: string;
296
+ title: string;
297
+ summary: string;
298
+ raw_ref: string | undefined;
299
+ }[];
300
+ recommended_next_tools: string[];
301
+ next_tool_inputs: {
302
+ tool: import("taurusdb-core").DiagnosticToolName | "show_processlist";
303
+ input: Record<string, unknown>;
304
+ rationale: string;
305
+ }[];
306
+ limitations: string[] | undefined;
307
+ };
308
+ export declare function toPublicDbHotspotResult(result: DbHotspotResult): {
309
+ tool: "diagnose_db_hotspot";
310
+ status: import("taurusdb-core").DiagnosticStatus;
311
+ summary: string;
312
+ diagnosis_window: {
313
+ from: string | undefined;
314
+ to: string | undefined;
315
+ relative: string | undefined;
316
+ };
317
+ scope: "table" | "sql" | "session" | "all";
318
+ hotspots: {
319
+ type: "table" | "sql" | "session";
320
+ title: string;
321
+ confidence: import("taurusdb-core").DiagnosticConfidence;
322
+ sql_hash: string | undefined;
323
+ digest_text: string | undefined;
324
+ sample_sql: string | undefined;
325
+ session_id: string | undefined;
326
+ table: string | undefined;
327
+ rationale: string;
328
+ evidence_sources: string[];
329
+ recommendation: string | undefined;
330
+ }[];
331
+ evidence: {
332
+ source: string;
333
+ title: string;
334
+ summary: string;
335
+ raw_ref: string | undefined;
336
+ }[];
337
+ recommended_next_tools: string[];
338
+ next_tool_inputs: {
339
+ tool: import("taurusdb-core").DiagnosticToolName | "show_processlist";
340
+ input: Record<string, unknown>;
341
+ rationale: string;
342
+ }[];
343
+ limitations: string[] | undefined;
344
+ };
@@ -0,0 +1,348 @@
1
+ export function toPublicDataSourceInfo(info) {
2
+ return {
3
+ name: info.name,
4
+ engine: info.engine,
5
+ host: info.host,
6
+ port: info.port,
7
+ database: info.database,
8
+ has_mutation_user: info.hasMutationUser,
9
+ pool_size: info.poolSize,
10
+ is_default: info.isDefault,
11
+ };
12
+ }
13
+ export function toPublicDatabaseInfo(info) {
14
+ return {
15
+ name: info.name,
16
+ owner: info.owner,
17
+ comment: info.comment,
18
+ };
19
+ }
20
+ export function toPublicTableInfo(info) {
21
+ return {
22
+ database: info.database,
23
+ name: info.name,
24
+ type: info.type,
25
+ comment: info.comment,
26
+ row_count_estimate: info.rowCountEstimate,
27
+ };
28
+ }
29
+ export function toPublicTableSchema(schema) {
30
+ return {
31
+ database: schema.database,
32
+ table: schema.table,
33
+ columns: schema.columns.map((column) => ({
34
+ name: column.name,
35
+ data_type: column.dataType,
36
+ nullable: column.nullable,
37
+ default_value: column.defaultValue,
38
+ max_length: column.maxLength,
39
+ is_primary_key: column.isPrimaryKey,
40
+ is_indexed: column.isIndexed,
41
+ comment: column.comment,
42
+ })),
43
+ indexes: schema.indexes.map((index) => ({
44
+ name: index.name,
45
+ columns: index.columns,
46
+ unique: index.unique,
47
+ type: index.type,
48
+ })),
49
+ primary_key: schema.primaryKey,
50
+ engine_hints: schema.engineHints
51
+ ? {
52
+ likely_time_columns: schema.engineHints.likelyTimeColumns,
53
+ likely_filter_columns: schema.engineHints.likelyFilterColumns,
54
+ sensitive_columns: schema.engineHints.sensitiveColumns,
55
+ }
56
+ : undefined,
57
+ comment: schema.comment,
58
+ row_count_estimate: schema.rowCountEstimate,
59
+ };
60
+ }
61
+ export function toPublicQueryResult(result) {
62
+ return {
63
+ columns: result.columns,
64
+ rows: result.rows,
65
+ row_count: result.rowCount,
66
+ original_row_count: result.originalRowCount,
67
+ truncated: result.truncated,
68
+ row_truncated: result.rowTruncated,
69
+ column_truncated: result.columnTruncated,
70
+ field_truncated: result.fieldTruncated,
71
+ redacted_columns: result.redactedColumns,
72
+ dropped_columns: result.droppedColumns,
73
+ truncated_columns: result.truncatedColumns,
74
+ };
75
+ }
76
+ export function toPublicMutationResult(result) {
77
+ return {
78
+ affected_rows: result.affectedRows,
79
+ };
80
+ }
81
+ export function toPublicGuardrailDecision(decision) {
82
+ return {
83
+ action: decision.action,
84
+ risk_level: decision.riskLevel,
85
+ reason_codes: decision.reasonCodes,
86
+ risk_hints: decision.riskHints,
87
+ requires_explain: decision.requiresExplain,
88
+ requires_confirmation: decision.requiresConfirmation,
89
+ sql_hash: decision.sqlHash,
90
+ runtime_limits: {
91
+ readonly: decision.runtimeLimits.readonly,
92
+ timeout_ms: decision.runtimeLimits.timeoutMs,
93
+ max_rows: decision.runtimeLimits.maxRows,
94
+ max_columns: decision.runtimeLimits.maxColumns,
95
+ max_field_chars: decision.runtimeLimits.maxFieldChars,
96
+ },
97
+ };
98
+ }
99
+ export function toPublicExplainResult(result, decision) {
100
+ return {
101
+ plan: result.plan,
102
+ risk_summary: {
103
+ full_table_scan_likely: result.riskSummary.fullTableScanLikely,
104
+ index_hit_likely: result.riskSummary.indexHitLikely,
105
+ estimated_rows: result.riskSummary.estimatedRows,
106
+ uses_temp_structure: result.riskSummary.usesTempStructure,
107
+ uses_filesort: result.riskSummary.usesFilesort,
108
+ risk_hints: result.riskSummary.riskHints,
109
+ },
110
+ recommendations: result.recommendations,
111
+ guardrail: toPublicGuardrailDecision(decision),
112
+ };
113
+ }
114
+ export function toPublicKernelInfo(info) {
115
+ return {
116
+ is_taurusdb: info.isTaurusDB,
117
+ kernel_version: info.kernelVersion,
118
+ mysql_compat: info.mysqlCompat,
119
+ instance_spec_hint: info.instanceSpecHint,
120
+ raw_version: info.rawVersion,
121
+ };
122
+ }
123
+ function toPublicFeatureStatus(status) {
124
+ return Object.fromEntries(Object.entries(status).map(([key, value]) => {
125
+ if (key === "minVersion") {
126
+ return ["min_version", value];
127
+ }
128
+ return [key, value];
129
+ }));
130
+ }
131
+ const HIDDEN_PUBLIC_FEATURES = new Set([
132
+ "statement_outline",
133
+ "column_compression",
134
+ "multi_tenant",
135
+ "partition_mdl",
136
+ "hot_row_update",
137
+ ]);
138
+ export function toPublicFeatureMatrix(features) {
139
+ return Object.fromEntries(Object.entries(features)
140
+ .filter(([name]) => !HIDDEN_PUBLIC_FEATURES.has(name))
141
+ .map(([name, status]) => [name, toPublicFeatureStatus(status)]));
142
+ }
143
+ export function toPublicEnhancedExplainResult(result, decision) {
144
+ return {
145
+ standard_plan: toPublicExplainResult(result.standardPlan, decision),
146
+ tree_plan: result.treePlan,
147
+ taurus_hints: {
148
+ ndp_pushdown: {
149
+ condition: result.taurusHints.ndpPushdown.condition,
150
+ columns: result.taurusHints.ndpPushdown.columns,
151
+ aggregate: result.taurusHints.ndpPushdown.aggregate,
152
+ blocked_reason: result.taurusHints.ndpPushdown.blockedReason,
153
+ },
154
+ parallel_query: {
155
+ would_enable: result.taurusHints.parallelQuery.wouldEnable,
156
+ estimated_degree: result.taurusHints.parallelQuery.estimatedDegree,
157
+ blocked_reason: result.taurusHints.parallelQuery.blockedReason,
158
+ },
159
+ offset_pushdown: result.taurusHints.offsetPushdown,
160
+ },
161
+ feature_explanations: {
162
+ ndp_pushdown: {
163
+ matched: result.featureExplanations.ndpPushdown.matched,
164
+ meaning: result.featureExplanations.ndpPushdown.meaning,
165
+ why_triggered: result.featureExplanations.ndpPushdown.whyTriggered,
166
+ expected_benefit: result.featureExplanations.ndpPushdown.expectedBenefit,
167
+ },
168
+ parallel_query: {
169
+ matched: result.featureExplanations.parallelQuery.matched,
170
+ meaning: result.featureExplanations.parallelQuery.meaning,
171
+ why_triggered: result.featureExplanations.parallelQuery.whyTriggered,
172
+ expected_benefit: result.featureExplanations.parallelQuery.expectedBenefit,
173
+ },
174
+ offset_pushdown: {
175
+ matched: result.featureExplanations.offsetPushdown.matched,
176
+ meaning: result.featureExplanations.offsetPushdown.meaning,
177
+ why_triggered: result.featureExplanations.offsetPushdown.whyTriggered,
178
+ expected_benefit: result.featureExplanations.offsetPushdown.expectedBenefit,
179
+ },
180
+ },
181
+ optimization_suggestions: result.optimizationSuggestions,
182
+ };
183
+ }
184
+ export function toPublicDiagnosticResult(result) {
185
+ return {
186
+ tool: result.tool,
187
+ status: result.status,
188
+ severity: result.severity,
189
+ summary: result.summary,
190
+ diagnosis_window: {
191
+ from: result.diagnosisWindow.from,
192
+ to: result.diagnosisWindow.to,
193
+ relative: result.diagnosisWindow.relative,
194
+ },
195
+ root_cause_candidates: result.rootCauseCandidates.map((candidate) => ({
196
+ code: candidate.code,
197
+ title: candidate.title,
198
+ confidence: candidate.confidence,
199
+ rationale: candidate.rationale,
200
+ })),
201
+ key_findings: result.keyFindings,
202
+ suspicious_entities: result.suspiciousEntities
203
+ ? {
204
+ sqls: result.suspiciousEntities.sqls?.map((item) => ({
205
+ sql_hash: item.sqlHash,
206
+ digest_text: item.digestText,
207
+ reason: item.reason,
208
+ })),
209
+ sessions: result.suspiciousEntities.sessions?.map((item) => ({
210
+ session_id: item.sessionId,
211
+ user: item.user,
212
+ state: item.state,
213
+ reason: item.reason,
214
+ })),
215
+ tables: result.suspiciousEntities.tables?.map((item) => ({
216
+ table: item.table,
217
+ reason: item.reason,
218
+ })),
219
+ users: result.suspiciousEntities.users?.map((item) => ({
220
+ user: item.user,
221
+ client_host: item.clientHost,
222
+ reason: item.reason,
223
+ })),
224
+ }
225
+ : undefined,
226
+ evidence: result.evidence.map((item) => ({
227
+ source: item.source,
228
+ title: item.title,
229
+ summary: item.summary,
230
+ raw_ref: item.rawRef,
231
+ })),
232
+ recommended_actions: result.recommendedActions,
233
+ recommended_next_tools: result.recommendedNextTools,
234
+ next_tool_inputs: result.nextToolInputs?.map((item) => ({
235
+ tool: item.tool,
236
+ input: item.input,
237
+ rationale: item.rationale,
238
+ })),
239
+ limitations: result.limitations,
240
+ };
241
+ }
242
+ export function toPublicTopSlowSqlResult(result) {
243
+ return {
244
+ tool: result.tool,
245
+ status: result.status,
246
+ summary: result.summary,
247
+ diagnosis_window: {
248
+ from: result.diagnosisWindow.from,
249
+ to: result.diagnosisWindow.to,
250
+ relative: result.diagnosisWindow.relative,
251
+ },
252
+ top_sqls: result.topSqls.map((item) => ({
253
+ sql_hash: item.sqlHash,
254
+ digest_text: item.digestText,
255
+ sample_sql: item.sampleSql,
256
+ avg_latency_ms: item.avgLatencyMs,
257
+ total_latency_ms: item.totalLatencyMs,
258
+ exec_count: item.execCount,
259
+ avg_lock_time_ms: item.avgLockTimeMs,
260
+ avg_rows_examined: item.avgRowsExamined,
261
+ evidence_sources: item.evidenceSources,
262
+ recommendation: item.recommendation,
263
+ })),
264
+ evidence: result.evidence.map((item) => ({
265
+ source: item.source,
266
+ title: item.title,
267
+ summary: item.summary,
268
+ raw_ref: item.rawRef,
269
+ })),
270
+ limitations: result.limitations,
271
+ };
272
+ }
273
+ export function toPublicServiceLatencyResult(result) {
274
+ return {
275
+ tool: result.tool,
276
+ status: result.status,
277
+ summary: result.summary,
278
+ diagnosis_window: {
279
+ from: result.diagnosisWindow.from,
280
+ to: result.diagnosisWindow.to,
281
+ relative: result.diagnosisWindow.relative,
282
+ },
283
+ suspected_category: result.suspectedCategory,
284
+ top_candidates: result.topCandidates.map((item) => ({
285
+ type: item.type,
286
+ title: item.title,
287
+ confidence: item.confidence,
288
+ sql_hash: item.sqlHash,
289
+ digest_text: item.digestText,
290
+ sample_sql: item.sampleSql,
291
+ session_id: item.sessionId,
292
+ table: item.table,
293
+ rationale: item.rationale,
294
+ })),
295
+ evidence: result.evidence.map((item) => ({
296
+ source: item.source,
297
+ title: item.title,
298
+ summary: item.summary,
299
+ raw_ref: item.rawRef,
300
+ })),
301
+ recommended_next_tools: result.recommendedNextTools,
302
+ next_tool_inputs: result.nextToolInputs.map((item) => ({
303
+ tool: item.tool,
304
+ input: item.input,
305
+ rationale: item.rationale,
306
+ })),
307
+ limitations: result.limitations,
308
+ };
309
+ }
310
+ export function toPublicDbHotspotResult(result) {
311
+ return {
312
+ tool: result.tool,
313
+ status: result.status,
314
+ summary: result.summary,
315
+ diagnosis_window: {
316
+ from: result.diagnosisWindow.from,
317
+ to: result.diagnosisWindow.to,
318
+ relative: result.diagnosisWindow.relative,
319
+ },
320
+ scope: result.scope,
321
+ hotspots: result.hotspots.map((item) => ({
322
+ type: item.type,
323
+ title: item.title,
324
+ confidence: item.confidence,
325
+ sql_hash: item.sqlHash,
326
+ digest_text: item.digestText,
327
+ sample_sql: item.sampleSql,
328
+ session_id: item.sessionId,
329
+ table: item.table,
330
+ rationale: item.rationale,
331
+ evidence_sources: item.evidenceSources,
332
+ recommendation: item.recommendation,
333
+ })),
334
+ evidence: result.evidence.map((item) => ({
335
+ source: item.source,
336
+ title: item.title,
337
+ summary: item.summary,
338
+ raw_ref: item.rawRef,
339
+ })),
340
+ recommended_next_tools: result.recommendedNextTools,
341
+ next_tool_inputs: result.nextToolInputs.map((item) => ({
342
+ tool: item.tool,
343
+ input: item.input,
344
+ rationale: item.rationale,
345
+ })),
346
+ limitations: result.limitations,
347
+ };
348
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./common/input.js";
2
+ export * from "./common/public-formatters.js";
@@ -0,0 +1,2 @@
1
+ export * from "./common/input.js";
2
+ export * from "./common/public-formatters.js";
@@ -0,0 +1,5 @@
1
+ import type { ToolDefinition } from "./registry.js";
2
+ export declare const listDataSourcesTool: ToolDefinition;
3
+ export declare const listDatabasesTool: ToolDefinition;
4
+ export declare const listTablesTool: ToolDefinition;
5
+ export declare const describeTableTool: ToolDefinition;