• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

apowers313 / servherd / 20961701317

13 Jan 2026 03:07PM UTC coverage: 82.727% (+1.2%) from 81.563%
20961701317

push

github

apowers313
test: improved test coverage to 81.56%

901 of 1027 branches covered (87.73%)

Branch coverage included in aggregate %.

3601 of 4415 relevant lines covered (81.56%)

13.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.0
/src/mcp/tools/remove.ts
1
import { z } from "zod";
1✔
2
import { executeRemove } from "../../cli/commands/remove.js";
3
import type { RemoveResult } from "../../cli/output/formatters.js";
4

5
export const removeToolName = "servherd_remove";
1✔
6

7
export const removeToolDescription =
1✔
8
  "Permanently remove servers from the registry and process management. " +
1✔
9
  "Use this tool when a server is no longer needed and should be completely removed, not just stopped. " +
10
  "This stops the server process, removes it from PM2, and deletes it from the servherd registry. " +
11
  "Can target a specific server by name, all servers with a particular tag, or all managed servers at once. " +
12
  "Returns a list of results for each server with success status and a summary message. " +
13
  "Unlike servherd_stop, removed servers cannot be restarted without starting them again from scratch.";
14

15
export const removeToolSchema = z.object({
1✔
16
  name: z.string().optional().describe("Name of the server to remove, e.g., 'frontend-dev' or 'brave-tiger'"),
1✔
17
  all: z.boolean().optional().describe("Set to true to remove all managed servers"),
1✔
18
  tag: z.string().optional().describe("Remove all servers with this tag, e.g., 'temporary' or 'test'"),
1✔
19
  force: z.boolean().optional().describe("Skip confirmation (always true in MCP context)"),
1✔
20
});
1✔
21

22
export type RemoveToolInput = z.infer<typeof removeToolSchema>;
23

24
export interface RemoveToolResult {
25
  results: RemoveResult[];
26
  summary: string;
27
}
28

29
export async function handleRemoveTool(input: RemoveToolInput): Promise<RemoveToolResult> {
5✔
30
  // Validate input
31
  if (!input.name && !input.all && !input.tag) {
5✔
32
    throw new Error("Either name, all, or tag must be provided");
1✔
33
  }
1✔
34

35
  // Always force in MCP context since we can't prompt
36
  const results = await executeRemove({
4✔
37
    name: input.name,
4✔
38
    all: input.all,
4✔
39
    tag: input.tag,
4✔
40
    force: true, // MCP context can't prompt for confirmation
4✔
41
  });
4✔
42

43
  const successCount = results.filter((r) => r.success).length;
4✔
44
  const failCount = results.filter((r) => !r.success && !r.cancelled).length;
4✔
45

46
  let summary: string;
4✔
47
  if (results.length === 0) {
5!
48
    summary = "No servers found to remove";
×
49
  } else if (failCount === 0) {
5✔
50
    summary = `Successfully removed ${successCount} server${successCount !== 1 ? "s" : ""}`;
3✔
51
  } else {
4✔
52
    summary = `Removed ${successCount} server${successCount !== 1 ? "s" : ""}, ${failCount} failed`;
1!
53
  }
1✔
54

55
  return {
4✔
56
    results,
4✔
57
    summary,
4✔
58
  };
4✔
59
}
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc