@aristanetworks/eos-mcp-server 0.6.1-beta → 0.8.1-beta

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 (76) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +171 -44
  3. package/dist/config/diagnostics.d.ts +65 -0
  4. package/dist/config/diagnostics.js +38 -0
  5. package/dist/config/diagnostics.js.map +1 -0
  6. package/dist/config/loadConfig.js +1 -0
  7. package/dist/config/loadConfig.js.map +1 -1
  8. package/dist/config/schema.d.ts +182 -8
  9. package/dist/config/schema.js +3 -0
  10. package/dist/config/schema.js.map +1 -1
  11. package/dist/diagnostics/concurrency.d.ts +29 -0
  12. package/dist/diagnostics/concurrency.js +115 -0
  13. package/dist/diagnostics/concurrency.js.map +1 -0
  14. package/dist/diagnostics/eapiRunner.d.ts +10 -0
  15. package/dist/diagnostics/eapiRunner.js +52 -0
  16. package/dist/diagnostics/eapiRunner.js.map +1 -0
  17. package/dist/diagnostics/executionError.d.ts +7 -0
  18. package/dist/diagnostics/executionError.js +10 -0
  19. package/dist/diagnostics/executionError.js.map +1 -0
  20. package/dist/diagnostics/executor.d.ts +31 -0
  21. package/dist/diagnostics/executor.js +114 -0
  22. package/dist/diagnostics/executor.js.map +1 -0
  23. package/dist/diagnostics/ping.d.ts +7 -0
  24. package/dist/diagnostics/ping.js +131 -0
  25. package/dist/diagnostics/ping.js.map +1 -0
  26. package/dist/diagnostics/types.d.ts +81 -0
  27. package/dist/diagnostics/types.js +2 -0
  28. package/dist/diagnostics/types.js.map +1 -0
  29. package/dist/eapi/client.d.ts +3 -1
  30. package/dist/eapi/client.js +18 -6
  31. package/dist/eapi/client.js.map +1 -1
  32. package/dist/eapi/types.d.ts +9 -0
  33. package/dist/eapi/types.js.map +1 -1
  34. package/dist/inventory/buildModel.js +1 -0
  35. package/dist/inventory/buildModel.js.map +1 -1
  36. package/dist/inventory/listInventoryView.d.ts +1 -0
  37. package/dist/inventory/listInventoryView.js +1 -0
  38. package/dist/inventory/listInventoryView.js.map +1 -1
  39. package/dist/inventory/policy.d.ts +1 -0
  40. package/dist/inventory/policy.js +3 -1
  41. package/dist/inventory/policy.js.map +1 -1
  42. package/dist/inventory/types.d.ts +1 -0
  43. package/dist/inventory/varValidation.js +1 -0
  44. package/dist/inventory/varValidation.js.map +1 -1
  45. package/dist/mcp/createServer.js +39 -4
  46. package/dist/mcp/createServer.js.map +1 -1
  47. package/dist/mcp/tools/getServerInfo.d.ts +2 -1
  48. package/dist/mcp/tools/getServerInfo.js +2 -2
  49. package/dist/mcp/tools/getServerInfo.js.map +1 -1
  50. package/dist/mcp/tools/ping.d.ts +31 -0
  51. package/dist/mcp/tools/ping.js +27 -0
  52. package/dist/mcp/tools/ping.js.map +1 -0
  53. package/dist/operations/readExecution.d.ts +3 -1
  54. package/dist/operations/readExecution.js +24 -16
  55. package/dist/operations/readExecution.js.map +1 -1
  56. package/dist/serverInfo/buildServerInfo.d.ts +2 -1
  57. package/dist/serverInfo/buildServerInfo.js +17 -2
  58. package/dist/serverInfo/buildServerInfo.js.map +1 -1
  59. package/dist/serverInfo/types.d.ts +16 -0
  60. package/docs/CHECKPOINT.md +8 -1
  61. package/docs/CODE_WALKTHROUGH.md +25 -6
  62. package/docs/DESIGN.md +17 -4
  63. package/docs/DIAGNOSTICS.md +167 -0
  64. package/docs/IMPLEMENTATION_PLAN.md +4 -3
  65. package/docs/QUICKSTART.md +13 -13
  66. package/docs/adr/0001-non-configuring-diagnostics.md +5 -0
  67. package/docs/adr/0002-fail-closed-diagnostic-reservations.md +9 -0
  68. package/docs/adr/0003-durable-diagnostic-ledger.md +11 -0
  69. package/docs/adr/0004-offline-operator-attested-release.md +7 -0
  70. package/docs/adr/0005-multi-destination-ping.md +9 -0
  71. package/docs/adr/0006-in-memory-timed-diagnostic-capacity.md +21 -0
  72. package/docs/research/eos-diagnostic-lifecycle.md +86 -0
  73. package/package.json +1 -1
  74. package/dist/inventory/writePolicy.d.ts +0 -2
  75. package/dist/inventory/writePolicy.js +0 -36
  76. package/dist/inventory/writePolicy.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"varValidation.js","sourceRoot":"","sources":["../../src/inventory/varValidation.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,kBAAkB;IAClB,oBAAoB;IACpB,gCAAgC;CACjC,CAAC,CAAC;AAEH,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,cAAc;IACd,cAAc;IACd,oBAAoB;IACpB,cAAc;IACd,kBAAkB;IAClB,kBAAkB;CACnB,CAAC,CAAC;AAEH,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAEpE,MAAM,UAAU,8BAA8B,CAAC,SAA8B,EAAE,OAA0B;IACvG,cAAc,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEtD,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9C,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,KAAK,CAAC,IAAI,OAAO,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7D,cAAc,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAAmB,EAAE,SAAiB,EAAE,OAA0B;IACxF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,SAAS,GAAG,GAAG,SAAS,IAAI,GAAG,EAAE,CAAC;QAExC,IAAI,gB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OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,OAA0B,EAAE,IAAY,EAAE,GAAW,EAAE,KAAc,EAAE,QAAgB;IAC3G,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;QAClB,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE,GAAG,IAAI,YAAY,QAAQ,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QAC3E,IAAI;KACL,CAAC,CAAC;AACL,CAAC"}
@@ -3,7 +3,11 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { EapiDeviceReader } from "../connection/eosDeviceReader.js";
5
5
  import { APP_NAME, APP_VERSION } from "../core/version.js";
6
+ import { toErrorMessage } from "../core/errors.js";
6
7
  import { EapiClient } from "../eapi/client.js";
8
+ import { EapiDiagnosticRunner } from "../diagnostics/eapiRunner.js";
9
+ import { DiagnosticExecutor } from "../diagnostics/executor.js";
10
+ import { buildPingToolResult, pingInputSchema } from "./tools/ping.js";
7
11
  import { buildGetFactsToolResult, getFactsInputSchema } from "./tools/getFacts.js";
8
12
  import { buildGetRunningConfigToolResult, getRunningConfigInputSchema } from "./tools/getRunningConfig.js";
9
13
  import { buildGetServerInfoToolResult, getServerInfoInputSchema } from "./tools/getServerInfo.js";
@@ -17,7 +21,7 @@ function buildToolDefinitions(deps) {
17
21
  name: "eos_get_server_info",
18
22
  description: "Return a sanitized summary of current server capabilities, limits, runtime mode, and inventory summary.",
19
23
  inputSchema: getServerInfoInputSchema,
20
- handler: async () => buildGetServerInfoToolResult(deps.runtimeContext)
24
+ handler: async () => buildGetServerInfoToolResult(deps.runtimeContext, deps.diagnostics.getCapacity())
21
25
  },
22
26
  {
23
27
  name: "eos_list_inventory",
@@ -31,6 +35,12 @@ function buildToolDefinitions(deps) {
31
35
  inputSchema: probeDevicesInputSchema,
32
36
  handler: async (args) => buildProbeDevicesToolResult(deps.inventoryModel, deps.config, args, deps.deviceReader)
33
37
  },
38
+ {
39
+ name: "eos_ping",
40
+ description: "Run bounded, non-configuring ping diagnostics from an inventory host or group to one or more destinations concurrently. Requires explicit diagnostic permission. Destinations are unicast IP literals. Returns one result per host and destination; execution success is separate from reachability, and no replies do not identify a cause.",
41
+ inputSchema: pingInputSchema,
42
+ handler: async (args, extra) => buildPingToolResult(args, deps.diagnostics, extra.signal)
43
+ },
34
44
  {
35
45
  name: "eos_run_show",
36
46
  description: "Run one or more EOS show commands against a host or group target. Supports auto/json/text output modes with strict show-only validation.",
@@ -64,19 +74,44 @@ export async function startMcpServer(config, inventoryModel) {
64
74
  config,
65
75
  inventorySummary: inventoryModel.summary
66
76
  };
67
- const deviceReader = new EapiDeviceReader(config, new EapiClient());
77
+ const client = new EapiClient();
78
+ const deviceReader = new EapiDeviceReader(config, client);
79
+ const diagnostics = new DiagnosticExecutor(inventoryModel, config, new EapiDiagnosticRunner(config, client));
68
80
  const server = new McpServer({
69
81
  name: APP_NAME,
70
82
  version: APP_VERSION
71
83
  });
72
84
  const registerTool = server.registerTool.bind(server);
73
- for (const tool of buildToolDefinitions({ runtimeContext, inventoryModel, config, deviceReader })) {
85
+ for (const tool of buildToolDefinitions({ runtimeContext, inventoryModel, config, deviceReader, diagnostics })) {
74
86
  registerTool(tool.name, {
75
87
  description: tool.description,
76
88
  inputSchema: tool.inputSchema
77
89
  }, tool.handler);
78
90
  }
91
+ const stop = () => {
92
+ void server.close().catch((error) => {
93
+ console.error(toErrorMessage(error));
94
+ cleanup();
95
+ process.exitCode = 1;
96
+ });
97
+ };
98
+ const cleanup = () => {
99
+ process.off("SIGINT", stop);
100
+ process.off("SIGTERM", stop);
101
+ process.stdin.off("end", stop);
102
+ diagnostics.close();
103
+ };
104
+ server.server.onclose = cleanup;
105
+ process.once("SIGINT", stop);
106
+ process.once("SIGTERM", stop);
107
+ process.stdin.once("end", stop);
79
108
  const transport = new StdioServerTransport();
80
- await server.connect(transport);
109
+ try {
110
+ await server.connect(transport);
111
+ }
112
+ catch (error) {
113
+ cleanup();
114
+ throw error;
115
+ }
81
116
  }
82
117
  //# sourceMappingURL=createServer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createServer.js","sourceRoot":"","sources":["../../src/mcp/createServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,OAAO,EAAE,gBAAgB,EAAwB,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC3G,OAAO,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAS5F,SAAS,oBAAoB,CAAC,IAA4B;IACxD,OAAO;QACL;YACE,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EAAE,yGAAyG;YACtH,WAAW,EAAE,wB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C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;QACV,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { z } from "zod";
2
+ import type { DiagnosticCapacitySnapshot } from "../../diagnostics/types.js";
2
3
  import type { ServerRuntimeContext } from "../../serverInfo/types.js";
3
4
  export declare const getServerInfoInputSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
4
- export declare function buildGetServerInfoToolResult(runtimeContext: ServerRuntimeContext): {
5
+ export declare function buildGetServerInfoToolResult(runtimeContext: ServerRuntimeContext, diagnosticCapacity?: DiagnosticCapacitySnapshot): {
5
6
  content: {
6
7
  type: "text";
7
8
  text: string;
@@ -2,8 +2,8 @@ import { z } from "zod";
2
2
  import { buildServerInfo } from "../../serverInfo/buildServerInfo.js";
3
3
  import { buildJsonToolResult } from "../toolResult.js";
4
4
  export const getServerInfoInputSchema = z.object({}).strict();
5
- export function buildGetServerInfoToolResult(runtimeContext) {
6
- const info = buildServerInfo(runtimeContext);
5
+ export function buildGetServerInfoToolResult(runtimeContext, diagnosticCapacity) {
6
+ const info = buildServerInfo(runtimeContext, diagnosticCapacity);
7
7
  return buildJsonToolResult(info);
8
8
  }
9
9
  //# sourceMappingURL=getServerInfo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getServerInfo.js","sourceRoot":"","sources":["../../../src/mcp/tools/getServerInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE9D,MAAM,UAAU,4BAA4B,CAAC,cAAoC;IAC/E,MAAM,IAAI,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IAE7C,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
1
+ {"version":3,"file":"getServerInfo.js","sourceRoot":"","sources":["../../../src/mcp/tools/getServerInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAGtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE9D,MAAM,UAAU,4BAA4B,CAAC,cAAoC,EAAE,kBAA+C;IAChI,MAAM,IAAI,GAAG,eAAe,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAEjE,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import type { DiagnosticExecutor } from "../../diagnostics/executor.js";
3
+ export declare const pingInputSchema: z.ZodObject<{
4
+ target: z.ZodString;
5
+ destinations: z.ZodArray<z.ZodString, "many">;
6
+ count: z.ZodOptional<z.ZodNumber>;
7
+ vrf: z.ZodOptional<z.ZodString>;
8
+ source: z.ZodOptional<z.ZodString>;
9
+ include_raw: z.ZodDefault<z.ZodBoolean>;
10
+ }, "strict", z.ZodTypeAny, {
11
+ target: string;
12
+ destinations: string[];
13
+ include_raw: boolean;
14
+ count?: number | undefined;
15
+ vrf?: string | undefined;
16
+ source?: string | undefined;
17
+ }, {
18
+ target: string;
19
+ destinations: string[];
20
+ count?: number | undefined;
21
+ vrf?: string | undefined;
22
+ source?: string | undefined;
23
+ include_raw?: boolean | undefined;
24
+ }>;
25
+ export declare function buildPingToolResult(args: z.infer<typeof pingInputSchema>, executor: DiagnosticExecutor, signal?: AbortSignal): Promise<{
26
+ content: {
27
+ type: "text";
28
+ text: string;
29
+ }[];
30
+ structuredContent: Record<string, unknown>;
31
+ }>;
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { buildJsonToolResult } from "../toolResult.js";
3
+ export const pingInputSchema = z.object({
4
+ target: z.string().min(1).describe("Inventory host or group executing the diagnostic"),
5
+ destinations: z.array(z.string().min(1)).min(1)
6
+ .describe("Unique unicast IPv4/IPv6 literals to test from every target host; need not be in inventory. Use one entry for a single ping. Bounded by diagnostics.maxDestinationsPerRequest"),
7
+ count: z.number().int().positive().optional().describe("Packet count per destination, bounded by server settings; defaults to diagnostics.defaultPingCount"),
8
+ vrf: z.string().min(1).optional().describe("Explicit VRF for every destination; omission uses the EOS default"),
9
+ source: z.string().min(1).optional().describe("Source IP literal in the same address family as every destination"),
10
+ include_raw: z.boolean().default(false)
11
+ }).strict("Unrecognized field. eos_ping accepts target, destinations, count, vrf, source, and include_raw; use destinations: [\"<ip>\"] for a single ping");
12
+ export async function buildPingToolResult(args, executor, signal) {
13
+ const payload = await executor.execute({
14
+ target: args.target,
15
+ request: {
16
+ kind: "ping",
17
+ destinations: args.destinations,
18
+ ...(args.count === undefined ? {} : { count: args.count }),
19
+ ...(args.vrf === undefined ? {} : { vrf: args.vrf }),
20
+ ...(args.source === undefined ? {} : { source: args.source })
21
+ },
22
+ includeRaw: args.include_raw,
23
+ ...(signal === undefined ? {} : { signal })
24
+ });
25
+ return buildJsonToolResult(payload);
26
+ }
27
+ //# sourceMappingURL=ping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping.js","sourceRoot":"","sources":["../../../src/mcp/tools/ping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE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AG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;YACpD,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;SAC9D;QACD,UAAU,EAAE,IAAI,CAAC,WAAW;QAC5B,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5C,CAAC,CAAC;IACH,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
@@ -37,6 +37,7 @@ interface ReadOperationResultEnvelopeOptions<TExtra extends Record<string, unkno
37
37
  export declare function executeReadOperation<TDeviceResult extends ReadDeviceResultBase>(model: InventoryModel, config: ResolvedServerConfig, options: {
38
38
  target: string;
39
39
  operationName: string;
40
+ signal?: AbortSignal;
40
41
  validateTarget?: (resolvedTarget: ResolvedInventoryTarget) => void;
41
42
  run: (host: InventoryHostModel, signal: AbortSignal) => Promise<TDeviceResult>;
42
43
  onError: (host: InventoryHostModel, error: unknown) => TDeviceResult;
@@ -52,6 +53,7 @@ export declare function buildReadDeviceFailure(host: InventoryHostModel, errorCo
52
53
  export declare function enforceReadTargetLimit(config: ResolvedServerConfig, targetCount: number): void;
53
54
  export declare function enforceShowCommandLimit(config: ResolvedServerConfig, commandCount: number): void;
54
55
  export declare function mapWithConcurrency<T, R>(items: T[], concurrencyLimit: number, worker: (item: T) => Promise<R>, signal?: AbortSignal): Promise<R[]>;
55
- export declare function runWithOperationTimeout<T>(config: ResolvedServerConfig, operationName: string, run: (signal: AbortSignal) => Promise<T>): Promise<T>;
56
+ export declare function runWithOperationTimeout<T>(config: ResolvedServerConfig, operationName: string, run: (signal: AbortSignal) => Promise<T>, callerSignal?: AbortSignal): Promise<T>;
56
57
  export declare function enforceResponseSizeLimit(config: ResolvedServerConfig, payload: unknown, operationName: string, narrowingGuidance?: string): void;
58
+ export declare function buildDeviceResultSummary(results: ReadDeviceResultBase[]): DeviceResultSummary;
57
59
  export {};
@@ -11,7 +11,7 @@ export async function executeReadOperation(model, config, options) {
11
11
  catch (error) {
12
12
  return options.onError(host, error);
13
13
  }
14
- }, signal));
14
+ }, signal), options.signal);
15
15
  return {
16
16
  resolvedTarget,
17
17
  results,
@@ -79,29 +79,37 @@ export async function mapWithConcurrency(items, concurrencyLimit, worker, signal
79
79
  await Promise.all(Array.from({ length: workerCount }, () => runWorker()));
80
80
  return results;
81
81
  }
82
- export async function runWithOperationTimeout(config, operationName, run) {
82
+ export async function runWithOperationTimeout(config, operationName, run, callerSignal) {
83
83
  const controller = new AbortController();
84
- const operation = run(controller.signal);
85
- if (config.overallOperationTimeoutMs === undefined) {
86
- return operation;
84
+ const onCancel = () => controller.abort(new AppError("operation_aborted", `${operationName} was cancelled`));
85
+ callerSignal?.addEventListener("abort", onCancel, { once: true });
86
+ if (callerSignal?.aborted) {
87
+ onCancel();
87
88
  }
88
89
  let timeout;
90
+ let onAbort;
89
91
  try {
90
- return await Promise.race([
91
- operation,
92
- new Promise((_resolve, reject) => {
93
- timeout = setTimeout(() => {
94
- const error = new AppError("operation_timeout", `${operationName} exceeded overallOperationTimeoutMs ${config.overallOperationTimeoutMs}`);
95
- reject(error);
96
- controller.abort(error);
97
- }, config.overallOperationTimeoutMs);
98
- })
99
- ]);
92
+ if (config.overallOperationTimeoutMs !== undefined) {
93
+ timeout = setTimeout(() => controller.abort(new AppError("operation_timeout", `${operationName} exceeded overallOperationTimeoutMs ${config.overallOperationTimeoutMs}`)), config.overallOperationTimeoutMs);
94
+ }
95
+ const aborted = new Promise((_resolve, reject) => {
96
+ onAbort = () => reject(controller.signal.reason);
97
+ controller.signal.addEventListener("abort", onAbort, { once: true });
98
+ if (controller.signal.aborted) {
99
+ onAbort();
100
+ }
101
+ });
102
+ const operation = controller.signal.aborted ? aborted : run(controller.signal);
103
+ return await Promise.race([operation, aborted]);
100
104
  }
101
105
  finally {
102
106
  if (timeout !== undefined) {
103
107
  clearTimeout(timeout);
104
108
  }
109
+ callerSignal?.removeEventListener("abort", onCancel);
110
+ if (onAbort !== undefined) {
111
+ controller.signal.removeEventListener("abort", onAbort);
112
+ }
105
113
  }
106
114
  }
107
115
  function throwIfAborted(signal) {
@@ -122,7 +130,7 @@ export function enforceResponseSizeLimit(config, payload, operationName, narrowi
122
130
  });
123
131
  }
124
132
  }
125
- function buildDeviceResultSummary(results) {
133
+ export function buildDeviceResultSummary(results) {
126
134
  return {
127
135
  total_count: results.length,
128
136
  success_count: results.filter((result) => result.status === "success").length,
@@ -1 +1 @@
1
- {"version":3,"file":"readExecution.js","sourceRoot":"","sources":["../../src/operations/readExecution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAgC,MAAM,+BAA+B,CAAC;AA0CrG,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAqB,EACrB,MAA4B,EAC5B,OAMC;IAED,MAAM,cAAc,GAAG,sBAAsB,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACjF,sBAAsB,CAAC,MAAM,EAAE,cAAc,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACpE,OAAO,CAAC,cAAc,EAAE,CAAC,cAAc,CAAC,CAAC;IAEzC,MAAM,OAAO,GAAG,MAAM,uBAAuB,CAC3C,MAAM,EACN,OAAO,CAAC,aAAa,EACrB,CAAC,MAAM,EAAE,EAAE,CACT,kBAAkB,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACxF,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzC,CAAC;QAAC,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,CAAC,oBAAoB;YACjD,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAClE,QAAQ,EAAE,iBAAiB,IAAI,eAAe;SAC/C,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAA+B;IACtE,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,MAAM;QAC3B,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,MAAM;QAC7E,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM;KAC5E,CAAC;AACJ,CAAC"}
@@ -1,2 +1,3 @@
1
+ import type { DiagnosticCapacitySnapshot } from "../diagnostics/types.js";
1
2
  import type { ServerInfo, ServerRuntimeContext } from "./types.js";
2
- export declare function buildServerInfo(context: ServerRuntimeContext): ServerInfo;
3
+ export declare function buildServerInfo(context: ServerRuntimeContext, diagnosticCapacity?: DiagnosticCapacitySnapshot): ServerInfo;
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { APP_NAME, APP_VERSION } from "../core/version.js";
3
- export function buildServerInfo(context) {
3
+ export function buildServerInfo(context, diagnosticCapacity) {
4
4
  const summary = context.inventorySummary;
5
5
  return {
6
6
  server_name: APP_NAME,
@@ -29,7 +29,22 @@ export function buildServerInfo(context) {
29
29
  max_read_targets: context.config.maxReadTargets,
30
30
  max_show_commands_per_request: context.config.maxShowCommandsPerRequest,
31
31
  max_logging_messages_per_request: context.config.maxLoggingMessagesPerRequest,
32
- max_response_size_bytes: context.config.maxResponseSizeBytes
32
+ max_response_size_bytes: context.config.maxResponseSizeBytes,
33
+ diagnostics: {
34
+ default_ping_count: context.config.diagnostics.defaultPingCount,
35
+ max_ping_count: context.config.diagnostics.maxPingCount,
36
+ max_probes_per_request: context.config.diagnostics.maxProbesPerRequest,
37
+ max_destinations_per_request: context.config.diagnostics.maxDestinationsPerRequest,
38
+ device_concurrency: context.config.diagnostics.deviceConcurrency,
39
+ ping_reply_timeout_ms: context.config.diagnostics.pingReplyTimeoutMs,
40
+ command_timeout_ms: context.config.diagnostics.commandTimeoutMs,
41
+ http_timeout_ms: context.config.diagnostics.httpTimeoutMs,
42
+ overall_operation_timeout_ms: context.config.diagnostics.overallOperationTimeoutMs,
43
+ native_request_timeout: context.config.diagnostics.nativeRequestTimeout
44
+ }
45
+ },
46
+ diagnostics: {
47
+ capacity: diagnosticCapacity ?? null
33
48
  },
34
49
  logging: {
35
50
  actor: context.config.actor ?? null,
@@ -1 +1 @@
1
- {"version":3,"file":"buildServerInfo.js","sourceRoot":"","sources":["../../src/serverInfo/buildServerInfo.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG3D,MAAM,UAAU,eAAe,CAAC,OAA6B;IAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAEzC,OAAO;QACL,WAAW,EAAE,QAAQ;QACrB,cAAc,EAAE,WAAW;QAC3B,WAAW,EAAE,OAAO,CAAC,UAAU;QAC/B,UAAU,EAAE,OAAO,CAAC,SAAS;QAC7B,YAAY,EAAE,WAAW;QACzB,SAAS,EAAE;YACT,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;YAC7E,WAAW,EAAE,OAAO,EAAE,UAAU,IAAI,IAAI;YACxC,WAAW,EAAE,OAAO,EAAE,cAAc,IAAI,IAAI;YAC5C,YAAY,EAAE,OAAO,EAAE,eAAe,IAAI,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IAED,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { ResolvedServerConfig } from "../config/schema.js";
2
+ import type { DiagnosticCapacitySnapshot } from "../diagnostics/types.js";
2
3
  import type { EapiVersion } from "../eapi/types.js";
3
4
  import type { InventorySummary } from "../inventory/types.js";
4
5
  export interface ServerRuntimeContext {
@@ -35,6 +36,21 @@ export interface ServerInfo {
35
36
  max_show_commands_per_request: number;
36
37
  max_logging_messages_per_request: number;
37
38
  max_response_size_bytes: number;
39
+ diagnostics: {
40
+ default_ping_count: number;
41
+ max_ping_count: number;
42
+ max_probes_per_request: number;
43
+ max_destinations_per_request: number;
44
+ device_concurrency: number;
45
+ ping_reply_timeout_ms: number;
46
+ command_timeout_ms: number;
47
+ http_timeout_ms: number;
48
+ overall_operation_timeout_ms: number;
49
+ native_request_timeout: boolean;
50
+ };
51
+ };
52
+ diagnostics: {
53
+ capacity: DiagnosticCapacitySnapshot | null;
38
54
  };
39
55
  logging: {
40
56
  actor: string | null;
@@ -11,6 +11,7 @@ The server is a test-backed, read-only MCP service for Arista EOS eAPI. The prod
11
11
  - `eos_get_server_info`
12
12
  - `eos_list_inventory`
13
13
  - `eos_probe_devices`
14
+ - `eos_ping` (bounded active diagnostics to one or more destinations, explicit inventory opt-in)
14
15
  - `eos_run_show`
15
16
  - `eos_show_logging`
16
17
  - `eos_get_facts`
@@ -32,6 +33,10 @@ The server is a test-backed, read-only MCP service for Arista EOS eAPI. The prod
32
33
  - HTTPS with certificate validation by default and optional custom CA support.
33
34
  - Validated show commands and bounded logging/running-configuration queries.
34
35
  - Read-operation concurrency, target, response-size, and timeout controls.
36
+ - Configurable diagnostic budgets, in-memory per-server admission, independent timeouts, and uncertain reservations held for the command budget after unknown remote completion (ADR 0006).
37
+ - JSON-RPC version/ID and result/error exclusivity validation precedes output interpretation or read-only fallback; unrelated acknowledgements cannot free diagnostic capacity.
38
+ - Live sanitized capacity/reservation visibility in server info, including when each uncertain slot frees. A qualified native remote kill/deadline mechanism remains unimplemented; installed EOS requestTimeout is not an end-to-end termination guarantee.
39
+ - No retries or shell/SSH fallback for ping. Non-configuring diagnostics are not passive reads; traceroute and capture are not implemented.
35
40
  - Sanitized result envelopes with stable machine-readable errors.
36
41
 
37
42
  ## Re-entry reading
@@ -43,4 +48,6 @@ The server is a test-backed, read-only MCP service for Arista EOS eAPI. The prod
43
48
 
44
49
  ## Validation
45
50
 
46
- Run `npm test`, `npm run typecheck`, and `npm run build` after changes. Optional integration tests require the configured cEOS environment.
51
+ Run `npm test`, `npm run typecheck`, `npm run lint`, and `npm run build` after changes. Optional integration tests require the configured cEOS environment. Ping's module and MCP stdio integration suites are qualified on cEOS 4.34.3M; see [DIAGNOSTICS.md](DIAGNOSTICS.md).
52
+
53
+ Latest verification (in-memory capacity, ADR 0006): unit suite, typecheck, static policy and build pass; `INTEGRATION=1` was run against the cEOS lab, including a second server pinging the same inventory while the first held an uncertain slot.
@@ -14,7 +14,7 @@ This repository is a single TypeScript/Node package.
14
14
 
15
15
  ## Runtime Entry
16
16
 
17
- Execution starts at `src/index.ts`. It parses CLI args, loads config, then dispatches one of four commands:
17
+ Execution starts at `src/index.ts`. It parses CLI args, loads config, then dispatches one of six commands:
18
18
 
19
19
  - `serve`: load inventory, validate startup credentials, start MCP stdio server.
20
20
  - `validate-inventory`: validate inventory and print the result.
@@ -25,7 +25,7 @@ CLI parsing lives in `src/cli.ts`. The app name and version are read from `packa
25
25
 
26
26
  ## Config And Inventory
27
27
 
28
- Config loading is in `src/config/loadConfig.ts`, with Zod schemas in `src/config/schema.ts`. It merges optional config-file values with CLI overrides and resolves paths.
28
+ Config loading is in `src/config/loadConfig.ts`, with Zod schemas in `src/config/schema.ts`. Diagnostic defaults and cross-setting budget validation live in `src/config/diagnostics.ts`. It merges optional config-file values with CLI overrides and resolves paths.
29
29
 
30
30
  `src/inventory/loadInventory.ts` orchestrates inventory loading. It supports simplified YAML and canonical Ansible-style YAML by delegating to a pipeline: parsing (`src/inventory/parse.ts`), schema detection and normalization (`src/inventory/normalize.ts`), structural and variable-type validation (`src/inventory/validateNormalized.ts`, `src/inventory/varValidation.ts`), and model construction (`src/inventory/buildModel.ts`). Together these validate structure, build effective host vars, resolve groups, and produce an `InventoryModel`.
31
31
 
@@ -35,7 +35,7 @@ Supporting inventory modules:
35
35
  - `src/inventory/internalTypes.ts` / `src/inventory/internalUtils.ts`: shared types and helpers used across the parsing/normalization/validation pipeline.
36
36
  - `src/inventory/effectiveVars.ts`: global/group/host variable inheritance and same-depth conflict handling.
37
37
  - `src/inventory/graph.ts`: group parent maps, group depths, host lineage, direct memberships, and resolved group hosts.
38
- - `src/inventory/policy.ts`: EOS eligibility and read access evaluation, including the `mcp_read_allowed` fail-closed check.
38
+ - `src/inventory/policy.ts`: EOS eligibility and read access evaluation, including `mcp_read_allowed` and the explicit `mcp_diagnostics_allowed` opt-in (read denial vetoes both).
39
39
  - `src/inventory/resolveTarget.ts`: host/group target resolution and policy fail-closed checks.
40
40
  - `src/inventory/listInventoryView.ts`: sanitized inventory view for MCP output.
41
41
 
@@ -49,8 +49,9 @@ Startup credential validation is in `src/connection/validateStartupConnections.t
49
49
 
50
50
  eAPI protocol and transport are split:
51
51
 
52
- - `src/eapi/client.ts`: builds JSON-RPC `runCmds` requests using the connection's `eapiVersion` (`"latest"` by default, `1` when pinned in config), handles HTTP errors, invalid JSON, JSON-RPC errors, and unexpected result counts. Supports opt-in enable mode (`{ enable: true }`) for privileged commands by prepending `enable` to the wire commands and stripping the extra result entry transparently. Per-request timeout and caller cancellation are combined with `AbortSignal`.
52
+ - `src/eapi/client.ts`: builds JSON-RPC `runCmds` requests using the connection's `eapiVersion` (`"latest"` by default, `1` when pinned in config), handles HTTP errors, invalid JSON, protocol version/response-ID correlation, exclusive result/error envelopes, JSON-RPC errors, and unexpected result counts. Supports opt-in enable mode (`{ enable: true }`) for privileged commands by prepending `enable` to the wire commands and stripping the extra result entry transparently. Per-request timeout and caller cancellation are combined with `AbortSignal`.
53
53
  - `src/eapi/transport.ts`: production HTTPS transport and test-friendly fetch transport. The production transport enforces `maxResponseSizeBytes` while chunks are received, before buffering an oversized device response.
54
+ - `src/eapi/client.ts` also exposes single-execution text commands for active diagnostics, without JSON fallback retries, using the reserved request identity supplied by the diagnostic execution context.
54
55
  - `src/eapi/types.ts`: shared eAPI types, the low-level `EosCommandRunner` interface used by `EapiDeviceReader`, `EapiCommandOptions`, and helpers for validating/drilling into eAPI JSON-RPC response payloads.
55
56
 
56
57
  ## Read Tool Services
@@ -71,15 +72,29 @@ Shared read orchestration lives in `src/operations/readExecution.ts`. It central
71
72
 
72
73
  Shared type-narrowing utilities (`isObject`, `readString`, `readBoolean`, `readNumber`, etc.) live in `src/utils/value.ts`.
73
74
 
75
+ ## Diagnostic Execution
76
+
77
+ - `src/diagnostics/executor.ts`: typed diagnostic orchestration, inventory opt-in and probe-budget checks, existing result envelopes, and cancellation. One executor is created per server instance.
78
+ - `src/diagnostics/concurrency.ts`: in-memory admission shared by concurrent calls in one server process. Unknown completion holds a slot for `commandTimeoutMs`, then a timer frees it; a late confirmed response frees it sooner. Shutdown rejects queued work; cancelled waiters are removed.
79
+ - `src/diagnostics/eapiRunner.ts`: connection resolution followed by one text eAPI attempt in enable mode. Separate error paths distinguish local rejection before dispatch from uncertain RPC, transport, or malformed-result failures after dispatch; there is no mutable dispatch flag or retry.
80
+ - `src/diagnostics/executionError.ts`: typed `AppError` classification (`not_dispatched`, `completed`, or `unknown`). Only explicitly settled errors permit capacity reuse; ordinary errors remain uncertain.
81
+ - `src/diagnostics/ping.ts`: literal-address/VRF/source/count validation, finite ping command construction, and loss/RTT interpretation. A no-reply finding is not an execution failure.
82
+ - `src/diagnostics/types.ts`: request, prepared intent, observation, and finding types discriminated by diagnostic kind, plus the `DiagnosticDeviceRunner` seam. Only ping is implemented; capture sessions are not pre-modeled.
83
+
84
+ Diagnostic execution reuses read-operation orchestration with independent settings and global admission. Unknown completion holds capacity for the command budget; HTTP abort is not a remote kill signal. Each server-info call reads `DiagnosticExecutor.getCapacity()` afresh; the standalone CLI reports no live snapshot.
85
+
86
+ Capacity lives in memory per server process, so several servers can run against one inventory. See [DIAGNOSTICS.md](DIAGNOSTICS.md) and [ADR 0006](adr/0006-in-memory-timed-diagnostic-capacity.md).
87
+
74
88
  ## MCP Layer
75
89
 
76
- The MCP server is assembled in `src/mcp/createServer.ts`. It creates the official SDK `McpServer`, registers seven read-only tools, and connects over stdio.
90
+ The MCP server is assembled in `src/mcp/createServer.ts`. It creates the official SDK `McpServer`, registers eight non-configuring tools, and connects over stdio. Ping forwards the MCP cancellation signal into diagnostic execution.
77
91
 
78
92
  Tool adapters live under `src/mcp/tools/`:
79
93
 
80
94
  - `getServerInfo.ts`
81
95
  - `listInventory.ts`
82
96
  - `probeDevices.ts`
97
+ - `ping.ts`
83
98
  - `runShow.ts`
84
99
  - `showLogging.ts`
85
100
  - `getFacts.ts`
@@ -96,6 +111,8 @@ Local CLI commands live in `src/commands/`:
96
111
  - `validateInventory.ts`
97
112
  - `printServerInfo.ts`
98
113
  - `probe.ts`
114
+ - `inspectDiagnostics.ts`
115
+ - `releaseDiagnostics.ts`
99
116
 
100
117
  ## Tests
101
118
 
@@ -105,8 +122,10 @@ Tests mirror the source layout:
105
122
  - Inventory and target behavior: `inventory.test.ts`, `targetResolution.test.ts`
106
123
  - eAPI and connection behavior: `eapiClient.test.ts`, `eosDeviceReader.test.ts`, `startupValidation.test.ts`, `responseSize.test.ts`
107
124
  - Read services and orchestration: `probeDevices.test.ts`, `runShow.test.ts`, `loggingQuery.test.ts`, `showLogging.test.ts`, `getFacts.test.ts`, `getRunningConfig.test.ts`, `readExecution.test.ts`
125
+ - Diagnostics: `ping.test.ts`, `diagnosticConfig.test.ts`, `diagnostics.test.ts`, `diagnosticEapi.test.ts`, `diagnosticReservations.test.ts` (timed release, cancellation, late responses and visibility)
126
+ - Response correlation: `eapiCorrelation.test.ts`
108
127
  - Server info and errors: `buildServerInfo.test.ts`, `errors.test.ts`, `errorTaxonomy.test.ts`
109
128
  - MCP adapters and stdio: `readToolsMcp.test.ts`, `probeDevicesTool.test.ts`, `listInventoryTool.test.ts`, `mcpStdioSmoke.test.ts`
110
129
  - Package/static policy: `packagePolicy.test.ts`, `packageSmoke.test.ts`
111
- - Optional cEOS integration (requires a configured lab): `integration.test.ts`
130
+ - Optional cEOS integration (requires a configured lab): `integration.test.ts`, `pingIntegration.test.ts`, `pingMcpIntegration.test.ts`
112
131
  - Shared test helpers: `test/helpers.ts`
package/docs/DESIGN.md CHANGED
@@ -11,6 +11,7 @@ EOS MCP Server is an ESM TypeScript MCP server that provides inventory-scoped, r
11
11
  | `eos_get_server_info` | Sanitized runtime, limits, and inventory summary |
12
12
  | `eos_list_inventory` | Eligible hosts and groups |
13
13
  | `eos_probe_devices` | Connectivity, authentication, and harmless command check |
14
+ | `eos_ping` | Explicitly authorized, bounded active ping diagnostics on EOS to one or more destinations |
14
15
  | `eos_run_show` | Validated single-line `show` commands |
15
16
  | `eos_show_logging` | Bounded logging retrieval |
16
17
  | `eos_get_facts` | Fixed device facts |
@@ -21,7 +22,7 @@ Local CLI commands provide inventory validation, server-info output, and probing
21
22
  ## Target boundary
22
23
 
23
24
  - A target is exactly one inventory host or group name.
24
- - Address, hostname, pattern, and ad-hoc targets are rejected.
25
+ - Address, hostname, pattern, and ad-hoc execution targets are rejected. Ping destinations are separate literal IP addresses and may be outside inventory.
25
26
  - Host and group names use `^[A-Za-z0-9_.-]+$` and cannot collide.
26
27
  - Group hosts are deduplicated and ordered alphabetically.
27
28
  - Canonical inventories merge repeated group declarations with host/child union and later-wins variables.
@@ -32,6 +33,8 @@ Canonical Ansible-style YAML and simplified YAML are supported. Structural keys
32
33
 
33
34
  `mcp_read_allowed` defaults to `true` for eligible EOS hosts and follows inherited inventory variable precedence. Operational requests fail closed when any resolved host is ineligible or read-denied — a mixed or ineligible target fails as a whole, and devices are never silently skipped. The inventory is the only policy source.
34
35
 
36
+ `mcp_diagnostics_allowed` defaults to `false` and must explicitly resolve to boolean `true` to permit diagnostics. It follows existing inheritance; EOS eligibility and read permission are prerequisites. Mixed diagnostic permission in a group fails the entire request before dispatch.
37
+
35
38
  ## Connection security
36
39
 
37
40
  - HTTPS is required.
@@ -41,16 +44,26 @@ Canonical Ansible-style YAML and simplified YAML are supported. Structural keys
41
44
 
42
45
  ## Command safety
43
46
 
44
- `eos_run_show` accepts only trimmed, single-line commands beginning with `show`. It rejects control characters, shell metacharacters, and CLI output modifiers. `eos_get_running_config.section` uses the same single-line restrictions. Enable mode is used only as needed to retrieve running configuration.
47
+ `eos_run_show` accepts only trimmed, single-line commands beginning with `show`. It rejects control characters, shell metacharacters, and CLI output modifiers. `eos_get_running_config.section` uses the same single-line restrictions. Enable mode is used only for operations that need it, currently running configuration and ping. Diagnostics accept typed, validated arguments, not arbitrary command strings; the show-only validator is not relaxed.
45
48
 
46
49
  ## Runtime controls
47
50
 
48
51
  Read requests have configured per-device timeout, optional overall timeout, device concurrency, target-count, command-count, logging-message, and response-size limits. The overall timeout aborts in-flight requests and halts further scheduling. Device HTTP responses and final serialized tool results are size-limited.
49
52
 
53
+ ### Active diagnostic controls
54
+
55
+ `eos_ping` uses independent `diagnostics` settings with finite defaults: count 3/max 10, aggregate probes 100 (hosts × destinations × count), 16 destinations per call, per-server device concurrency 5, reply timeout 1000 ms, command budget 30000 ms, HTTP timeout 35000 ms, and overall timeout 60000 ms. All are configurable; target and response-size limits are shared with reads. Config validation requires consistent counts, execution budgets, and HTTP timeouts.
56
+
57
+ A ping request names one or more destinations and sends exactly one text-mode eAPI request per host and destination, without automatic retries. Those executions run concurrently under the shared admission controller, each with its own reservation, and return one result per host and destination. Fixed count, one-second interval, fixed size 64, and reply timeout bound device work; by default each request also carries EOS `requestTimeout` set to the command budget (`diagnostics.nativeRequestTimeout`), which interrupts execution on the device but does not cover time queued before execution. HTTP abort is not proof of remote completion. Unknown completion holds its admission slot for the command budget, then frees it; a late confirmed response frees it sooner. Capacity is held in memory per server process, so several servers can use one inventory at once ([ADR 0006](adr/0006-in-memory-timed-diagnostic-capacity.md)). Server info exposes current sanitized capacity and reservation state. A qualified native remote deadline remains unresolved; timeout-shaped RPC errors are not assumed to confirm process exit. Cancellation stops scheduling and aborts HTTP requests; overall timeout remains a request-level failure without partial results. See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the full lifecycle assumptions and limits.
58
+
59
+ Only unicast literal destinations are supported; DNS, scoped/link-local IPv6, multicast, unspecified, and limited broadcast addresses are rejected. Optional VRF/source selection must not fall back. Directed-broadcast detection is not guaranteed from an address alone.
60
+
50
61
  ## Result and error model
51
62
 
52
- Device-facing tools return target metadata, resolved devices, summary counts, and per-device results. Request-level failures and known device failures use `AppError` machine-readable codes. Supported diagnostic tools expose raw eAPI payloads only through an explicit `include_raw` option.
63
+ Every eAPI response must identify JSON-RPC 2.0, match its request ID exactly, and contain exactly one result/error member before interpretation. Missing or mismatched identity is `eapi_response_uncorrelated`, not completion evidence. Each diagnostic execution's reservation ID is its wire ID. Correlation IDs do not provide an EOS job lookup, cancellation, or idempotency facility.
64
+
65
+ Device-facing tools return target metadata, resolved devices, summary counts, and per-device results. Request-level failures and known device failures use `AppError` machine-readable codes. Supported read tools expose raw eAPI payloads only through an explicit `include_raw` option. Ping separates successful execution from a reachability finding and returns normalized loss/RTT measurements; original EOS text is opt-in. Unrecognized output is an explicit device failure, never an invented finding.
53
66
 
54
67
  ## Compatibility and validation
55
68
 
56
- The read surface is validated against cEOS 4.34.3M. EOS 4.20 is the documented minimum for supported read operations. Changes must preserve strict TypeScript checks and pass the unit, stdio smoke, and package-policy test suites.
69
+ The read surface is validated against cEOS 4.34.3M. EOS 4.20 is the documented minimum for supported read operations. Ping is separately qualified on cEOS 4.34.3M; its compatibility with older EOS versions or physical platforms is not established by the existing read-path minimum. Traceroute and packet capture remain future work requiring their own capability and lifecycle decisions. Changes must preserve strict TypeScript checks and pass the unit, stdio smoke, and package-policy test suites.