MCPcopy Create free account
hub / github.com/github/gh-aw / parseMCPScriptsLogLine

Function parseMCPScriptsLogLine

actions/setup/js/parse_mcp_scripts_logs.cjs:78–100  ·  view source on GitHub ↗

* Parses a single mcp-scripts log line * Expected format: [timestamp] [server-name] message * @param {string} line - Log line to parse * @returns {Object|null} Parsed log entry or null if invalid

(line)

Source from the content-addressed store, hash-verified

76 * @returns {Object|null} Parsed log entry or null if invalid
77 */
78function parseMCPScriptsLogLine(line) {
79 // Match format: [timestamp] [server-name] message
80 const match = line.match(/^\[([^\]]+)\]\s+\[([^\]]+)\]\s+(.+)$/);
81
82 if (!match) {
83 // Return unparsed line as-is for display
84 return {
85 timestamp: null,
86 serverName: null,
87 message: line.trim(),
88 raw: true,
89 };
90 }
91
92 const [, timestamp, serverName, message] = match;
93
94 return {
95 timestamp: timestamp.trim(),
96 serverName: serverName.trim(),
97 message: message.trim(),
98 raw: false,
99 };
100}
101
102/**
103 * Generates a lightweight plain text summary optimized for console output.

Callers 2

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected