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

Function isLikelyCustomAgent

actions/setup/js/log_parser_shared.cjs:234–263  ·  view source on GitHub ↗

* Checks if a tool name looks like a custom agent (kebab-case with multiple words) * Custom agents have names like: add-safe-output-type, cli-consistency-checker, etc. * @param {string} toolName - The tool name to check * @returns {boolean} True if the tool name appears to be a custom agent

(toolName)

Source from the content-addressed store, hash-verified

232 * @returns {boolean} True if the tool name appears to be a custom agent
233 */
234function isLikelyCustomAgent(toolName) {
235 // Custom agents are kebab-case with at least one hyphen and multiple word segments
236 // They should not start with common prefixes like 'mcp__', 'safe', etc.
237 if (!toolName || typeof toolName !== "string") {
238 return false;
239 }
240
241 // Must contain at least one hyphen
242 if (!toolName.includes("-")) {
243 return false;
244 }
245
246 // Should not contain double underscores (MCP tools)
247 if (toolName.includes("__")) {
248 return false;
249 }
250
251 // Should not start with safe (safeoutputs, safeinputs handled separately)
252 if (toolName.toLowerCase().startsWith("safe")) {
253 return false;
254 }
255
256 // Should be all lowercase with hyphens (kebab-case)
257 // Allow letters, numbers, and hyphens only
258 if (!/^[a-z0-9]+(-[a-z0-9]+)+$/.test(toolName)) {
259 return false;
260 }
261
262 return true;
263}
264
265/**
266 * Generates information section markdown from the last log entry

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected