MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseStdioArgs

Function parseStdioArgs

packages/plugins/mcp/src/react/stdio-fields.ts:11–20  ·  view source on GitHub ↗
(raw: string)

Source from the content-addressed store, hash-verified

9/** Split the raw arguments field into tokens, honoring double-quoted groups so
10 * an argument with spaces stays intact. */
11export function parseStdioArgs(raw: string): string[] {
12 if (!raw.trim()) return [];
13 const args: string[] = [];
14 const regex = /[^\s"]+|"([^"]*)"/g;
15 let match;
16 while ((match = regex.exec(raw)) !== null) {
17 args.push(match[1] ?? match[0]);
18 }
19 return args;
20}
21
22/** Render stored arguments back into the single-line field, re-quoting any
23 * token that contains whitespace so `parseStdioArgs` recovers it. */

Callers 3

StdioEditFunction · 0.90
AddMcpIntegrationFunction · 0.90

Calls 2

execMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected