{"url_pattern":"^https?://(www\\.)?gsmarena\\.com(/.*)?$","site_name":"gsmarena","allowed_domains":["gsmarena.com"],"tools":[{"name":"gsmarena_search","description":"GSMArena 手机搜索","inputSchema":{"type":"object","properties":{"query":{"type":"string","description":"Phone name to search (e.g. iPhone 16, Galaxy S25)"}},"required":["query"]},"handler":"(params) => {\n  const run = async function(args) {\n\n      if (!args.query) return {error: 'Missing argument: query', hint: 'Provide a phone name to search'};\n\n      const q = encodeURIComponent(args.query);\n      const url = 'https://www.gsmarena.com/results.php3?sQuickSearch=yes&sName=' + q;\n      const resp = await fetch(url, {credentials: 'include'});\n      if (!resp.ok) return {error: 'HTTP ' + resp.status, hint: 'Make sure a gsmarena.com tab is open'};\n\n      const html = await resp.text();\n      const parser = new DOMParser();\n      const doc = parser.parseFromString(html, 'text/html');\n\n      const items = doc.querySelectorAll('div.makers ul li');\n      const results = [];\n\n      items.forEach(el => {\n        const anchor = el.querySelector('a');\n        if (!anchor) return;\n        const href = anchor.getAttribute('href');\n        const img = el.querySelector('img');\n        const nameEl = el.querySelector('span') || el.querySelector('a');\n\n        const phoneName = nameEl ? nameEl.textContent.trim() : '';\n        const imageUrl = img ? (img.getAttribute('src') || img.getAttribute('data-src') || '') : '';\n        const phoneUrl = href ? 'https://www.gsmarena.com/' + href : '';\n\n        if (phoneName) {\n          results.push({\n            name: phoneName,\n            url: phoneUrl,\n            image: imageUrl\n          });\n        }\n      });\n\n      return {query: args.query, count: results.length, results: results};\n  };\n  return run(params || {});\n}"}]}