@mcp-consultant-tools/log-analytics 28.0.0-beta.1 → 28.0.0-beta.10
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.
- package/build/cli/commands/function-commands.d.ts +7 -0
- package/build/cli/commands/function-commands.d.ts.map +1 -0
- package/build/cli/commands/function-commands.js +120 -0
- package/build/cli/commands/function-commands.js.map +1 -0
- package/build/cli/commands/index.d.ts +10 -0
- package/build/cli/commands/index.d.ts.map +1 -0
- package/build/cli/commands/index.js +15 -0
- package/build/cli/commands/index.js.map +1 -0
- package/build/cli/commands/query-commands.d.ts +7 -0
- package/build/cli/commands/query-commands.d.ts.map +1 -0
- package/build/cli/commands/query-commands.js +96 -0
- package/build/cli/commands/query-commands.js.map +1 -0
- package/build/cli/commands/workspace-commands.d.ts +7 -0
- package/build/cli/commands/workspace-commands.d.ts.map +1 -0
- package/build/cli/commands/workspace-commands.js +47 -0
- package/build/cli/commands/workspace-commands.js.map +1 -0
- package/build/cli/output.d.ts +11 -0
- package/build/cli/output.d.ts.map +1 -0
- package/build/cli/output.js +10 -0
- package/build/cli/output.js.map +1 -0
- package/build/cli.d.ts +9 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +27 -0
- package/build/cli.js.map +1 -0
- package/build/context-factory.d.ts +4 -0
- package/build/context-factory.d.ts.map +1 -0
- package/build/context-factory.js +45 -0
- package/build/context-factory.js.map +1 -0
- package/build/index.d.ts +14 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +35 -1121
- package/build/index.js.map +1 -1
- package/build/prompts/index.d.ts +7 -0
- package/build/prompts/index.d.ts.map +1 -0
- package/build/prompts/index.js +6 -0
- package/build/prompts/index.js.map +1 -0
- package/build/prompts/templates.d.ts +3 -0
- package/build/prompts/templates.d.ts.map +1 -0
- package/build/prompts/templates.js +195 -0
- package/build/prompts/templates.js.map +1 -0
- package/build/services/index.d.ts +3 -0
- package/build/services/index.d.ts.map +1 -0
- package/build/services/index.js +2 -0
- package/build/services/index.js.map +1 -0
- package/build/services/log-analytics-service.d.ts +117 -0
- package/build/services/log-analytics-service.d.ts.map +1 -0
- package/build/services/log-analytics-service.js +419 -0
- package/build/services/log-analytics-service.js.map +1 -0
- package/build/tool-examples.d.ts +1 -8
- package/build/tool-examples.d.ts.map +1 -1
- package/build/tool-examples.js +1 -12
- package/build/tool-examples.js.map +1 -1
- package/build/tools/function-tools.d.ts +3 -0
- package/build/tools/function-tools.d.ts.map +1 -0
- package/build/tools/function-tools.js +536 -0
- package/build/tools/function-tools.js.map +1 -0
- package/build/tools/index.d.ts +9 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +12 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/query-tools.d.ts +3 -0
- package/build/tools/query-tools.d.ts.map +1 -0
- package/build/tools/query-tools.js +105 -0
- package/build/tools/query-tools.js.map +1 -0
- package/build/tools/workspace-tools.d.ts +3 -0
- package/build/tools/workspace-tools.d.ts.map +1 -0
- package/build/tools/workspace-tools.js +53 -0
- package/build/tools/workspace-tools.js.map +1 -0
- package/build/types.d.ts +9 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/package.json +5 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function CLI Commands - 4 commands for Azure Functions monitoring
|
|
3
|
+
*/
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
import type { ServiceContext } from '../../context-factory.js';
|
|
6
|
+
export declare function registerFunctionCommands(program: Command, ctx: ServiceContext): void;
|
|
7
|
+
//# sourceMappingURL=function-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/function-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ/D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAuIpF"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function CLI Commands - 4 commands for Azure Functions monitoring
|
|
3
|
+
*/
|
|
4
|
+
import { getGlobalFlags, handleCliError } from '@mcp-consultant-tools/core';
|
|
5
|
+
import { outputResult } from '../output.js';
|
|
6
|
+
import { formatTableAsMarkdown, filterColumns, resolveColumnPreset, } from '../../utils/loganalytics-formatters.js';
|
|
7
|
+
export function registerFunctionCommands(program, ctx) {
|
|
8
|
+
const fn = program.command('fn').description('Azure Functions monitoring operations');
|
|
9
|
+
fn
|
|
10
|
+
.command('logs')
|
|
11
|
+
.description('Get Azure Function logs from FunctionAppLogs table')
|
|
12
|
+
.argument('<resourceId>', 'Resource ID')
|
|
13
|
+
.option('-n, --function-name <name>', 'Function name to filter by')
|
|
14
|
+
.option('-t, --timespan <timespan>', 'Time range (e.g., PT1H, P1D)', 'PT1H')
|
|
15
|
+
.option('-s, --severity <level>', 'Minimum severity level (0=Verbose, 1=Info, 2=Warning, 3=Error, 4=Critical)')
|
|
16
|
+
.option('-l, --limit <n>', 'Maximum results', '100')
|
|
17
|
+
.option('-p, --preset <preset>', 'Column preset: minimal, investigation, full')
|
|
18
|
+
.option('-c, --columns <columns>', 'Custom columns (comma-separated)')
|
|
19
|
+
.option('-f, --format <format>', 'Output format: json, markdown', 'json')
|
|
20
|
+
.action(async (resourceId, opts) => {
|
|
21
|
+
try {
|
|
22
|
+
const severity = opts.severity !== undefined ? parseInt(opts.severity) : undefined;
|
|
23
|
+
const result = await ctx.logAnalytics.getFunctionLogs(resourceId, opts.functionName, opts.timespan, severity, parseInt(opts.limit));
|
|
24
|
+
const columns = opts.columns ? opts.columns.split(',').map((c) => c.trim()) : undefined;
|
|
25
|
+
const columnsToInclude = resolveColumnPreset(opts.preset, columns);
|
|
26
|
+
const filteredTables = result.tables.map((t) => filterColumns(t, columnsToInclude));
|
|
27
|
+
const filteredResult = { ...result, tables: filteredTables };
|
|
28
|
+
let data = filteredResult;
|
|
29
|
+
if (opts.format === 'markdown' && filteredTables.length > 0) {
|
|
30
|
+
data = filteredTables.map((t) => formatTableAsMarkdown(t)).join('\n\n');
|
|
31
|
+
}
|
|
32
|
+
const rowCount = filteredTables.reduce((acc, t) => acc + (t.rows?.length || 0), 0);
|
|
33
|
+
const fnLabel = opts.functionName ? ` for '${opts.functionName}'` : '';
|
|
34
|
+
outputResult({ fileName: `fn-logs-${resourceId}`, data, summary: `Found ${rowCount} function log(s)${fnLabel}` }, getGlobalFlags(program));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
handleCliError(error, 'get function logs');
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
fn
|
|
41
|
+
.command('errors')
|
|
42
|
+
.description('Get Azure Function error logs with exception details')
|
|
43
|
+
.argument('<resourceId>', 'Resource ID')
|
|
44
|
+
.option('-n, --function-name <name>', 'Function name to filter by')
|
|
45
|
+
.option('-t, --timespan <timespan>', 'Time range (e.g., PT1H, P1D)', 'PT1H')
|
|
46
|
+
.option('-l, --limit <n>', 'Maximum results', '100')
|
|
47
|
+
.option('-p, --preset <preset>', 'Column preset: minimal, investigation, full')
|
|
48
|
+
.option('-c, --columns <columns>', 'Custom columns (comma-separated)')
|
|
49
|
+
.option('-f, --format <format>', 'Output format: json, markdown', 'json')
|
|
50
|
+
.action(async (resourceId, opts) => {
|
|
51
|
+
try {
|
|
52
|
+
const result = await ctx.logAnalytics.getFunctionErrors(resourceId, opts.functionName, opts.timespan, parseInt(opts.limit));
|
|
53
|
+
const columns = opts.columns ? opts.columns.split(',').map((c) => c.trim()) : undefined;
|
|
54
|
+
const columnsToInclude = resolveColumnPreset(opts.preset, columns);
|
|
55
|
+
const filteredTables = result.tables.map((t) => filterColumns(t, columnsToInclude));
|
|
56
|
+
const filteredResult = { ...result, tables: filteredTables };
|
|
57
|
+
let data = filteredResult;
|
|
58
|
+
if (opts.format === 'markdown' && filteredTables.length > 0) {
|
|
59
|
+
data = filteredTables.map((t) => formatTableAsMarkdown(t)).join('\n\n');
|
|
60
|
+
}
|
|
61
|
+
const rowCount = filteredTables.reduce((acc, t) => acc + (t.rows?.length || 0), 0);
|
|
62
|
+
const fnLabel = opts.functionName ? ` for '${opts.functionName}'` : '';
|
|
63
|
+
outputResult({ fileName: `fn-errors-${resourceId}`, data, summary: `Found ${rowCount} function error(s)${fnLabel}` }, getGlobalFlags(program));
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
handleCliError(error, 'get function errors');
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
fn
|
|
70
|
+
.command('stats')
|
|
71
|
+
.description('Get execution statistics for Azure Functions (count, success rate)')
|
|
72
|
+
.argument('<resourceId>', 'Resource ID')
|
|
73
|
+
.option('-n, --function-name <name>', 'Function name (stats for all if not specified)')
|
|
74
|
+
.option('-t, --timespan <timespan>', 'Time range (e.g., PT1H, P1D)', 'PT1H')
|
|
75
|
+
.option('-f, --format <format>', 'Output format: json, markdown', 'json')
|
|
76
|
+
.action(async (resourceId, opts) => {
|
|
77
|
+
try {
|
|
78
|
+
const result = await ctx.logAnalytics.getFunctionStats(resourceId, opts.functionName, opts.timespan);
|
|
79
|
+
let data = result;
|
|
80
|
+
if (opts.format === 'markdown' && result.tables && result.tables.length > 0) {
|
|
81
|
+
data = result.tables.map((t) => formatTableAsMarkdown(t)).join('\n\n');
|
|
82
|
+
}
|
|
83
|
+
const fnLabel = opts.functionName ? ` for '${opts.functionName}'` : ' for all functions';
|
|
84
|
+
outputResult({ fileName: `fn-stats-${resourceId}`, data, summary: `Function statistics${fnLabel}` }, getGlobalFlags(program));
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
handleCliError(error, 'get function stats');
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
fn
|
|
91
|
+
.command('invocations')
|
|
92
|
+
.description('Get Azure Function invocation history from requests/traces tables')
|
|
93
|
+
.argument('<resourceId>', 'Resource ID')
|
|
94
|
+
.option('-n, --function-name <name>', 'Function name to filter by')
|
|
95
|
+
.option('-t, --timespan <timespan>', 'Time range (e.g., PT1H, P1D)', 'PT1H')
|
|
96
|
+
.option('-l, --limit <n>', 'Maximum results', '100')
|
|
97
|
+
.option('-p, --preset <preset>', 'Column preset: minimal, investigation, full')
|
|
98
|
+
.option('-c, --columns <columns>', 'Custom columns (comma-separated)')
|
|
99
|
+
.option('-f, --format <format>', 'Output format: json, markdown', 'json')
|
|
100
|
+
.action(async (resourceId, opts) => {
|
|
101
|
+
try {
|
|
102
|
+
const result = await ctx.logAnalytics.getFunctionInvocations(resourceId, opts.functionName, opts.timespan, parseInt(opts.limit));
|
|
103
|
+
const columns = opts.columns ? opts.columns.split(',').map((c) => c.trim()) : undefined;
|
|
104
|
+
const columnsToInclude = resolveColumnPreset(opts.preset, columns);
|
|
105
|
+
const filteredTables = result.tables.map((t) => filterColumns(t, columnsToInclude));
|
|
106
|
+
const filteredResult = { ...result, tables: filteredTables };
|
|
107
|
+
let data = filteredResult;
|
|
108
|
+
if (opts.format === 'markdown' && filteredTables.length > 0) {
|
|
109
|
+
data = filteredTables.map((t) => formatTableAsMarkdown(t)).join('\n\n');
|
|
110
|
+
}
|
|
111
|
+
const rowCount = filteredTables.reduce((acc, t) => acc + (t.rows?.length || 0), 0);
|
|
112
|
+
const fnLabel = opts.functionName ? ` for '${opts.functionName}'` : '';
|
|
113
|
+
outputResult({ fileName: `fn-invocations-${resourceId}`, data, summary: `Found ${rowCount} invocation(s)${fnLabel}` }, getGlobalFlags(program));
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
handleCliError(error, 'get function invocations');
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=function-commands.js.map
|
|
@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I,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5D,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/E,CAAC;YAED,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,CAAM,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAChG,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvE,YAAY,CACV,EAAE,QAAQ,EAAE,kBAAkB,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,QAAQ,iBAAiB,OAAO,EAAE,EAAE,EACxG,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,cAAc,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAAC;QAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Commands barrel export + combined registration
|
|
3
|
+
*/
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
import type { ServiceContext } from '../../context-factory.js';
|
|
6
|
+
export declare function registerAllCommands(program: Command, ctx: ServiceContext): void;
|
|
7
|
+
export { registerQueryCommands } from './query-commands.js';
|
|
8
|
+
export { registerFunctionCommands } from './function-commands.js';
|
|
9
|
+
export { registerWorkspaceCommands } from './workspace-commands.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAI/E;AAED,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Commands barrel export + combined registration
|
|
3
|
+
*/
|
|
4
|
+
import { registerQueryCommands } from './query-commands.js';
|
|
5
|
+
import { registerFunctionCommands } from './function-commands.js';
|
|
6
|
+
import { registerWorkspaceCommands } from './workspace-commands.js';
|
|
7
|
+
export function registerAllCommands(program, ctx) {
|
|
8
|
+
registerQueryCommands(program, ctx);
|
|
9
|
+
registerFunctionCommands(program, ctx);
|
|
10
|
+
registerWorkspaceCommands(program, ctx);
|
|
11
|
+
}
|
|
12
|
+
export { registerQueryCommands } from './query-commands.js';
|
|
13
|
+
export { registerFunctionCommands } from './function-commands.js';
|
|
14
|
+
export { registerWorkspaceCommands } from './workspace-commands.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,GAAmB;IACvE,qBAAqB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACpC,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACvC,yBAAyB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query CLI Commands - 3 commands for KQL queries and log search
|
|
3
|
+
*/
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
import type { ServiceContext } from '../../context-factory.js';
|
|
6
|
+
export declare function registerQueryCommands(program: Command, ctx: ServiceContext): void;
|
|
7
|
+
//# sourceMappingURL=query-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/query-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ/D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAwGjF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query CLI Commands - 3 commands for KQL queries and log search
|
|
3
|
+
*/
|
|
4
|
+
import { getGlobalFlags, handleCliError } from '@mcp-consultant-tools/core';
|
|
5
|
+
import { outputResult } from '../output.js';
|
|
6
|
+
import { formatTableAsMarkdown, filterColumns, resolveColumnPreset, } from '../../utils/loganalytics-formatters.js';
|
|
7
|
+
export function registerQueryCommands(program, ctx) {
|
|
8
|
+
const query = program.command('query').description('KQL query and log search operations');
|
|
9
|
+
query
|
|
10
|
+
.command('execute')
|
|
11
|
+
.description('Execute a custom KQL query against Log Analytics workspace')
|
|
12
|
+
.argument('<resourceId>', 'Resource ID')
|
|
13
|
+
.argument('<kql>', 'KQL query string')
|
|
14
|
+
.option('-t, --timespan <timespan>', 'Time range (e.g., PT1H, P1D)', 'PT1H')
|
|
15
|
+
.option('-p, --preset <preset>', 'Column preset: minimal, investigation, full')
|
|
16
|
+
.option('-c, --columns <columns>', 'Custom columns (comma-separated)')
|
|
17
|
+
.option('-f, --format <format>', 'Output format: json, markdown', 'json')
|
|
18
|
+
.action(async (resourceId, kql, opts) => {
|
|
19
|
+
try {
|
|
20
|
+
const result = await ctx.logAnalytics.executeQuery(resourceId, kql, opts.timespan);
|
|
21
|
+
// Apply column filtering
|
|
22
|
+
const columns = opts.columns ? opts.columns.split(',').map((c) => c.trim()) : undefined;
|
|
23
|
+
const columnsToInclude = resolveColumnPreset(opts.preset, columns);
|
|
24
|
+
const filteredTables = result.tables.map((t) => filterColumns(t, columnsToInclude));
|
|
25
|
+
const filteredResult = { ...result, tables: filteredTables };
|
|
26
|
+
// Format output
|
|
27
|
+
let data = filteredResult;
|
|
28
|
+
if (opts.format === 'markdown' && filteredTables.length > 0) {
|
|
29
|
+
data = filteredTables.map((t) => formatTableAsMarkdown(t)).join('\n\n');
|
|
30
|
+
}
|
|
31
|
+
const rowCount = filteredTables.reduce((acc, t) => acc + (t.rows?.length || 0), 0);
|
|
32
|
+
outputResult({ fileName: `query-${resourceId}`, data, summary: `Query returned ${rowCount} row(s)` }, getGlobalFlags(program));
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
handleCliError(error, 'execute query');
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
query
|
|
39
|
+
.command('recent')
|
|
40
|
+
.description('Get recent events from a specific Log Analytics table')
|
|
41
|
+
.argument('<resourceId>', 'Resource ID')
|
|
42
|
+
.argument('<tableName>', 'Table name (e.g., AppTraces, AppExceptions, FunctionAppLogs)')
|
|
43
|
+
.option('-t, --timespan <timespan>', 'Time range (e.g., PT1H, P1D)', 'PT1H')
|
|
44
|
+
.option('-l, --limit <n>', 'Maximum results', '100')
|
|
45
|
+
.option('-p, --preset <preset>', 'Column preset: minimal, investigation, full')
|
|
46
|
+
.option('-c, --columns <columns>', 'Custom columns (comma-separated)')
|
|
47
|
+
.option('-f, --format <format>', 'Output format: json, markdown', 'json')
|
|
48
|
+
.action(async (resourceId, tableName, opts) => {
|
|
49
|
+
try {
|
|
50
|
+
const result = await ctx.logAnalytics.getRecentEvents(resourceId, tableName, opts.timespan, parseInt(opts.limit));
|
|
51
|
+
const columns = opts.columns ? opts.columns.split(',').map((c) => c.trim()) : undefined;
|
|
52
|
+
const columnsToInclude = resolveColumnPreset(opts.preset, columns);
|
|
53
|
+
const filteredTables = result.tables.map((t) => filterColumns(t, columnsToInclude));
|
|
54
|
+
const filteredResult = { ...result, tables: filteredTables };
|
|
55
|
+
let data = filteredResult;
|
|
56
|
+
if (opts.format === 'markdown' && filteredTables.length > 0) {
|
|
57
|
+
data = filteredTables.map((t) => formatTableAsMarkdown(t)).join('\n\n');
|
|
58
|
+
}
|
|
59
|
+
const rowCount = filteredTables.reduce((acc, t) => acc + (t.rows?.length || 0), 0);
|
|
60
|
+
outputResult({ fileName: `recent-${resourceId}-${tableName}`, data, summary: `Found ${rowCount} recent event(s) in ${tableName}` }, getGlobalFlags(program));
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
handleCliError(error, 'get recent events');
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
query
|
|
67
|
+
.command('search')
|
|
68
|
+
.description('Search logs by text content across tables or a specific table')
|
|
69
|
+
.argument('<resourceId>', 'Resource ID')
|
|
70
|
+
.argument('<searchText>', 'Text to search for (case-insensitive)')
|
|
71
|
+
.option('--table <tableName>', 'Table name to search in (searches all if not specified)')
|
|
72
|
+
.option('-t, --timespan <timespan>', 'Time range (e.g., PT1H, P1D)', 'PT1H')
|
|
73
|
+
.option('-l, --limit <n>', 'Maximum results', '100')
|
|
74
|
+
.option('-p, --preset <preset>', 'Column preset: minimal, investigation, full')
|
|
75
|
+
.option('-c, --columns <columns>', 'Custom columns (comma-separated)')
|
|
76
|
+
.option('-f, --format <format>', 'Output format: json, markdown', 'json')
|
|
77
|
+
.action(async (resourceId, searchText, opts) => {
|
|
78
|
+
try {
|
|
79
|
+
const result = await ctx.logAnalytics.searchLogs(resourceId, searchText, opts.table, opts.timespan, parseInt(opts.limit));
|
|
80
|
+
const columns = opts.columns ? opts.columns.split(',').map((c) => c.trim()) : undefined;
|
|
81
|
+
const columnsToInclude = resolveColumnPreset(opts.preset, columns);
|
|
82
|
+
const filteredTables = result.tables.map((t) => filterColumns(t, columnsToInclude));
|
|
83
|
+
const filteredResult = { ...result, tables: filteredTables };
|
|
84
|
+
let data = filteredResult;
|
|
85
|
+
if (opts.format === 'markdown' && filteredTables.length > 0) {
|
|
86
|
+
data = filteredTables.map((t) => formatTableAsMarkdown(t)).join('\n\n');
|
|
87
|
+
}
|
|
88
|
+
const rowCount = filteredTables.reduce((acc, t) => acc + (t.rows?.length || 0), 0);
|
|
89
|
+
outputResult({ fileName: `search-${resourceId}-${searchText.replace(/\s+/g, '-')}`, data, summary: `Found ${rowCount} result(s) matching '${searchText}'` }, getGlobalFlags(program));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
handleCliError(error, 'search logs');
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=query-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-commands.js","sourceRoot":"","sources":["../../../src/cli/commands/query-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE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Ac,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace CLI Commands - 3 commands for workspace management
|
|
3
|
+
*/
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
import type { ServiceContext } from '../../context-factory.js';
|
|
6
|
+
export declare function registerWorkspaceCommands(program: Command, ctx: ServiceContext): void;
|
|
7
|
+
//# sourceMappingURL=workspace-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/workspace-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CA2CrF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace CLI Commands - 3 commands for workspace management
|
|
3
|
+
*/
|
|
4
|
+
import { getGlobalFlags, handleCliError } from '@mcp-consultant-tools/core';
|
|
5
|
+
import { outputResult } from '../output.js';
|
|
6
|
+
export function registerWorkspaceCommands(program, ctx) {
|
|
7
|
+
const workspace = program.command('workspace').description('Workspace operations');
|
|
8
|
+
workspace
|
|
9
|
+
.command('list')
|
|
10
|
+
.description('List all configured Log Analytics workspaces (active and inactive)')
|
|
11
|
+
.action(async () => {
|
|
12
|
+
try {
|
|
13
|
+
const resources = ctx.logAnalytics.getAllResources();
|
|
14
|
+
outputResult({ fileName: 'workspaces', data: resources, summary: `Found ${resources.length} configured workspace(s)` }, getGlobalFlags(program));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
handleCliError(error, 'list workspaces');
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
workspace
|
|
21
|
+
.command('metadata')
|
|
22
|
+
.description('Get schema metadata (tables and columns) for a workspace')
|
|
23
|
+
.argument('<resourceId>', 'Resource ID (use workspace list to find IDs)')
|
|
24
|
+
.action(async (resourceId) => {
|
|
25
|
+
try {
|
|
26
|
+
const metadata = await ctx.logAnalytics.getMetadata(resourceId);
|
|
27
|
+
outputResult({ fileName: `metadata-${resourceId}`, data: metadata, summary: `Metadata for workspace '${resourceId}'` }, getGlobalFlags(program));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
handleCliError(error, 'get metadata');
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
workspace
|
|
34
|
+
.command('test')
|
|
35
|
+
.description('Test access to a Log Analytics workspace')
|
|
36
|
+
.argument('<resourceId>', 'Resource ID')
|
|
37
|
+
.action(async (resourceId) => {
|
|
38
|
+
try {
|
|
39
|
+
const result = await ctx.logAnalytics.testWorkspaceAccess(resourceId);
|
|
40
|
+
outputResult({ fileName: `test-${resourceId}`, data: result, summary: result.success ? `Access OK: ${result.message}` : `Access FAILED: ${result.message}` }, getGlobalFlags(program));
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
handleCliError(error, 'test access');
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=workspace-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-commands.js","sourceRoot":"","sources":["../../../src/cli/commands/workspace-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,yBAAyB,CAAC,OAAgB,EAAE,GAAmB;IAC7E,MAAM,SAAS,GAAG,OAAO,CAAC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ACvC,MAAM,CAAC,KAAK,EAAE,UAAkB,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;YACtE,YAAY,CACV,EAAE,QAAQ,EAAE,QAAQ,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,kBAAkB,MAAM,CAAC,OAAO,EAAE,EAAE,EAC/I,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI output helper for log-analytics package.
|
|
3
|
+
* Thin wrapper setting the package-specific cache directory.
|
|
4
|
+
*/
|
|
5
|
+
import { type GlobalFlags } from '@mcp-consultant-tools/core';
|
|
6
|
+
export declare function outputResult(opts: {
|
|
7
|
+
fileName: string;
|
|
8
|
+
data: unknown;
|
|
9
|
+
summary: string;
|
|
10
|
+
}, flags: GlobalFlags): void;
|
|
11
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoC,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIhG,wBAAgB,YAAY,CAC1B,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAC1D,KAAK,EAAE,WAAW,GACjB,IAAI,CAEN"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI output helper for log-analytics package.
|
|
3
|
+
* Thin wrapper setting the package-specific cache directory.
|
|
4
|
+
*/
|
|
5
|
+
import { outputResult as coreOutputResult } from '@mcp-consultant-tools/core';
|
|
6
|
+
const CACHE_DIR = '.mcp-loganalytics-cache';
|
|
7
|
+
export function outputResult(opts, flags) {
|
|
8
|
+
coreOutputResult({ ...opts, cacheDir: CACHE_DIR }, flags);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAoB,MAAM,4BAA4B,CAAC;AAEhG,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAE5C,MAAM,UAAU,YAAY,CAC1B,IAA0D,EAC1D,KAAkB;IAElB,gBAAgB,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;AAC5D,CAAC"}
|
package/build/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
package/build/cli.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @mcp-consultant-tools/log-analytics CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for Azure Log Analytics operations.
|
|
6
|
+
* Reuses the same ServiceContext and services as the MCP server.
|
|
7
|
+
*/
|
|
8
|
+
import { createCliProgram, loadEnvForCli } from '@mcp-consultant-tools/core';
|
|
9
|
+
import { createServiceContext } from './context-factory.js';
|
|
10
|
+
import { registerAllCommands } from './cli/commands/index.js';
|
|
11
|
+
const program = createCliProgram({
|
|
12
|
+
name: 'mcp-loganalytics-cli',
|
|
13
|
+
description: 'Azure Log Analytics CLI - workspace queries and Azure Functions monitoring',
|
|
14
|
+
version: '27.0.0',
|
|
15
|
+
});
|
|
16
|
+
// Load env before parsing (--env-file handled by commander hook)
|
|
17
|
+
program.hook('preAction', (thisCommand) => {
|
|
18
|
+
const opts = thisCommand.opts();
|
|
19
|
+
loadEnvForCli(opts.envFile);
|
|
20
|
+
});
|
|
21
|
+
const ctx = createServiceContext();
|
|
22
|
+
registerAllCommands(program, ctx);
|
|
23
|
+
program.parseAsync(process.argv).catch((error) => {
|
|
24
|
+
console.error('CLI error:', error.message);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=cli.js.map
|
package/build/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,OAAO,GAAG,gBAAgB,CAAC;IAC/B,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,4EAA4E;IACzF,OAAO,EAAE,QAAQ;CAClB,CAAC,CAAC;AAEH,iEAAiE;AACjE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,WAAgB,EAAE,EAAE;IAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IAChC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,oBAAoB,EAAE,CAAC;AACnC,mBAAmB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAElC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;IACpD,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-factory.d.ts","sourceRoot":"","sources":["../src/context-factory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,wBAAgB,oBAAoB,IAAI,cAAc,CAyCrD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared service context factory - used by both MCP server and CLI.
|
|
3
|
+
*/
|
|
4
|
+
import { LogAnalyticsService } from './services/log-analytics-service.js';
|
|
5
|
+
export function createServiceContext() {
|
|
6
|
+
let service = null;
|
|
7
|
+
function getService() {
|
|
8
|
+
if (!service) {
|
|
9
|
+
let resources = [];
|
|
10
|
+
if (process.env.LOGANALYTICS_RESOURCES) {
|
|
11
|
+
try {
|
|
12
|
+
resources = JSON.parse(process.env.LOGANALYTICS_RESOURCES);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
throw new Error('Failed to parse LOGANALYTICS_RESOURCES JSON');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else if (process.env.LOGANALYTICS_WORKSPACE_ID) {
|
|
19
|
+
resources = [{
|
|
20
|
+
id: 'default',
|
|
21
|
+
name: 'Default Workspace',
|
|
22
|
+
workspaceId: process.env.LOGANALYTICS_WORKSPACE_ID,
|
|
23
|
+
active: true,
|
|
24
|
+
}];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
throw new Error('Missing Log Analytics configuration: LOGANALYTICS_RESOURCES or LOGANALYTICS_WORKSPACE_ID');
|
|
28
|
+
}
|
|
29
|
+
const config = {
|
|
30
|
+
resources,
|
|
31
|
+
authMethod: (process.env.LOGANALYTICS_AUTH_METHOD || 'entra-id'),
|
|
32
|
+
tenantId: process.env.LOGANALYTICS_TENANT_ID || process.env.APPINSIGHTS_TENANT_ID || '',
|
|
33
|
+
clientId: process.env.LOGANALYTICS_CLIENT_ID || process.env.APPINSIGHTS_CLIENT_ID || '',
|
|
34
|
+
clientSecret: process.env.LOGANALYTICS_CLIENT_SECRET || process.env.APPINSIGHTS_CLIENT_SECRET || '',
|
|
35
|
+
};
|
|
36
|
+
service = new LogAnalyticsService(config);
|
|
37
|
+
console.error('Log Analytics service initialized');
|
|
38
|
+
}
|
|
39
|
+
return service;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
get logAnalytics() { return getService(); },
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=context-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-factory.js","sourceRoot":"","sources":["../src/context-factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAM1E,MAAM,UAAU,oBAAoB;IAClC,IAAI,OAAO,GAA+B,IAAI,CAAC;IAE/C,SAAS,UAAU;QACjB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,IAAI,SAAS,GAAU,EAAE,CAAC;YAE1B,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC;gBACvC,IAAI,CAAC;oBACH,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;gBAC7D,CAAC;gBAAC,MAAM,CAAC;oBACP,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;gBACjE,CAAC;YACH,CAAC;iBAAM,IAAI,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC;gBACjD,SAAS,GAAG,CAAC;wBACX,EAAE,EAAE,SAAS;wBACb,IAAI,EAAE,mBAAmB;wBACzB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB;wBAClD,MAAM,EAAE,IAAI;qBACb,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;YAC9G,CAAC;YAED,MAAM,MAAM,GAAuB;gBACjC,SAAS;gBACT,UAAU,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,UAAU,CAA2B;gBAC1F,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE;gBACvF,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE;gBACvF,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE;aACpG,CAAC;YAEF,OAAO,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;YAC1C,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,YAAY,KAAK,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC;KAC5C,CAAC;AACJ,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @mcp-consultant-tools/log-analytics
|
|
4
|
+
*
|
|
5
|
+
* MCP server for Azure Log Analytics integration.
|
|
6
|
+
* Entry point: MCP server startup + backward-compatible registerLogAnalyticsTools().
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Register Log Analytics tools and prompts to an MCP server.
|
|
10
|
+
* Backward-compatible API for the meta package.
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerLogAnalyticsTools(server: any): void;
|
|
13
|
+
export { LogAnalyticsService } from './services/log-analytics-service.js';
|
|
14
|
+
export type { LogAnalyticsConfig, LogAnalyticsResourceConfig, QueryResult, MetadataResult, } from './services/log-analytics-service.js';
|
|
15
|
+
export type { ServiceContext } from './types.js';
|
|
4
16
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AA2DH;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAI3D;AAGD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,YAAY,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACX,cAAc,GACf,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|