• 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.74
/src/mcp/tools/list.ts
1
import { z } from "zod";
1✔
2
import { executeList } from "../../cli/commands/list.js";
3
import type { ServerListItem } from "../../cli/output/formatters.js";
4

5
export const listToolName = "servherd_list";
1✔
6

7
export const listToolDescription =
1✔
8
  "List all managed development servers with their current status. " +
1✔
9
  "Use this tool to get an overview of all servers, check which servers are running, or find servers by tag, location, or command. " +
10
  "Can filter to show only running servers, servers with a specific tag, servers in a particular directory, or servers matching a command pattern (e.g., '*storybook*'). " +
11
  "Returns an array of server objects with name, status (online/stopped/errored), port, URL, working directory, command, and tags. " +
12
  "Also includes a count and summary message.";
13

14
export const listToolSchema = z.object({
1✔
15
  running: z.boolean().optional().describe("Set to true to only show servers that are currently running"),
1✔
16
  stopped: z.boolean().optional().describe("Set to true to only show servers that are currently stopped"),
1✔
17
  tag: z.string().optional().describe("Filter by tag, e.g., 'frontend' or 'api'"),
1✔
18
  cwd: z.string().optional().describe("Filter by working directory, e.g., '/home/user/projects/my-app'"),
1✔
19
  cmd: z.string().optional().describe("Filter by command pattern using glob syntax, e.g., '*storybook*' or '*vite*'"),
1✔
20
});
1✔
21

22
export type ListToolInput = z.infer<typeof listToolSchema>;
23

24
export interface ServerInfo {
25
  name: string;
26
  status: string;
27
  port: number;
28
  url: string;
29
  cwd: string;
30
  command: string;
31
  tags?: string[];
32
  hasDrift?: boolean;
33
}
34

35
export interface ListToolResult {
36
  servers: ServerInfo[];
37
  count: number;
38
  summary: string;
39
}
40

41
export async function handleListTool(input: ListToolInput): Promise<ListToolResult> {
7✔
42
  const result = await executeList({
7✔
43
    running: input.running,
7✔
44
    stopped: input.stopped,
7✔
45
    tag: input.tag,
7✔
46
    cwd: input.cwd,
7✔
47
    cmd: input.cmd,
7✔
48
  });
7✔
49

50
  const servers: ServerInfo[] = result.servers.map((item: ServerListItem) => ({
6✔
51
    name: item.server.name,
5✔
52
    status: item.status,
5✔
53
    port: item.server.port,
5✔
54
    url: `${item.server.protocol}://${item.server.hostname}:${item.server.port}`,
5✔
55
    cwd: item.server.cwd,
5✔
56
    command: item.server.command,
5✔
57
    tags: item.server.tags,
5✔
58
    hasDrift: item.hasDrift,
5✔
59
  }));
6✔
60

61
  const runningCount = servers.filter((s) => s.status === "online").length;
6✔
62
  const driftCount = servers.filter((s) => s.hasDrift).length;
6✔
63

64
  let summary: string;
6✔
65
  if (servers.length === 0) {
7✔
66
    summary = "No servers found";
2✔
67
  } else {
7✔
68
    summary = `${servers.length} server${servers.length !== 1 ? "s" : ""} (${runningCount} running)`;
4✔
69
    if (driftCount > 0) {
4!
70
      summary += `. ${driftCount} server${driftCount !== 1 ? "s have" : " has"} config drift - use servherd_restart to apply new config`;
×
71
    }
×
72
  }
4✔
73

74
  return {
6✔
75
    servers,
6✔
76
    count: servers.length,
6✔
77
    summary,
6✔
78
  };
6✔
79
}
6✔
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