MCPcopy Create free account
hub / github.com/microsoft/Webwright / extractModelToolPayload

Function extractModelToolPayload

assets/compare_trajectory/app.js:707–729  ·  view source on GitHub ↗
(args, fallbackCommand)

Source from the content-addressed store, hash-verified

705}
706
707function extractModelToolPayload(args, fallbackCommand) {
708 if (typeof args === 'string' && args.trim()) {
709 return args.trim();
710 }
711 if (!args || typeof args !== 'object') {
712 return String(fallbackCommand || '').trim();
713 }
714 for (const key of ['input', 'cmd', 'command', 'bash_command']) {
715 if (typeof args[key] === 'string' && args[key].trim()) {
716 return args[key].trim();
717 }
718 }
719 const picked = {};
720 ['query', 'path', 'pattern', 'skill', 'filePath', 'old_path', 'new_path'].forEach((key) => {
721 if (typeof args[key] === 'string' && args[key].trim()) {
722 picked[key] = args[key].trim();
723 }
724 });
725 if (Array.isArray(args.urls) && args.urls.length) {
726 picked.urls = args.urls;
727 }
728 return Object.keys(picked).length ? JSON.stringify(picked, null, 2) : String(fallbackCommand || '').trim();
729}
730
731function extractFirstPath(text) {
732 const match = String(text || '').match(/\/(?:[^\s`*]|\\ )+/);

Callers 2

parseSessionToolSectionFunction · 0.85
normalizeCodexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected