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

Function extractToolName

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

Source from the content-addressed store, hash-verified

106}
107
108function extractToolName(event) {
109 if (!event || typeof event !== "object") {
110 return null;
111 }
112
113 const candidates = [
114 event.tool_name,
115 event.tool?.name,
116 event.name,
117 event.recipient_name,
118 event.payload?.tool_name,
119 ];
120
121 for (const candidate of candidates) {
122 if (typeof candidate === "string" && candidate.trim()) {
123 return candidate.trim();
124 }
125 }
126
127 if (typeof event.type === "string" && event.type.includes("tool")) {
128 return event.type;
129 }
130
131 return null;
132}
133
134function isShellEvent(event) {
135 const type = typeof event?.type === "string" ? event.type : "";

Callers 2

isToolEventFunction · 0.85
summarizeCodexEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected