MCPcopy Create free account
hub / github.com/openai/plugins / extractShellCommand

Function extractShellCommand

plugins/plugin-eval/src/core/benchmark-events.js:81–106  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

79}
80
81function extractShellCommand(event) {
82 if (!event || typeof event !== "object") {
83 return null;
84 }
85
86 const candidates = [
87 event.command,
88 event.cmd,
89 event.parameters?.cmd,
90 event.arguments?.cmd,
91 event.payload?.command,
92 event.payload?.cmd,
93 ];
94
95 for (const candidate of candidates) {
96 if (typeof candidate === "string" && candidate.trim()) {
97 return candidate.trim();
98 }
99 }
100
101 if (event.recipient_name === "functions.exec_command") {
102 return event.parameters?.cmd || event.arguments?.cmd || event.command || "functions.exec_command";
103 }
104
105 return null;
106}
107
108function extractToolName(event) {
109 if (!event || typeof event !== "object") {

Callers 2

isShellEventFunction · 0.85
summarizeCodexEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected