gsmarena WebMCP
Browser tool configuration for gsmarena
Tools (1)
gsmarena_search()
GSMArena 手机搜索
Parameters
JavaScript Handler
(params) => {
const run = async function(args) {
if (!args.query) return {error: 'Missing argument: query', hint: 'Provide a phone name to search'};
const q = encodeURIComponent(args.query);
const url = 'https://www.gsmarena.com/results.php3?sQuickSearch=yes&sName=' + q;
const resp = await fetch(url, {credentials: 'include'});
if (!resp.ok) return {error: 'HTTP ' + resp.status, hint: 'Make sure a gsmarena.com tab is open'};
const html = await resp.text();
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const items = doc.querySelectorAll('div.makers ul li');
const results = [];
items.forEach(el => {
const anchor = el.querySelector('a');
if (!anchor) return;
const href = anchor.getAttribute('href');
const img = el.querySelector('img');
const nameEl = el.querySelector('span') || el.querySelector('a');
const phoneName = nameEl ? nameEl.textContent.trim() : '';
const imageUrl = img ? (img.getAttribute('src') || img.getAttribute('data-src') || '') : '';
const phoneUrl = href ? 'https://www.gsmarena.com/' + href : '';
if (phoneName) {
results.push({
name: phoneName,
url: phoneUrl,
image: imageUrl
});
}
});
return {query: args.query, count: results.length, results: results};
};
return run(params || {});
}
WebMCP clients
Use mcp-chrome, or fetch the same tools from the public API in your own browser automation runtime.
How to Use WebMCP
WebMCP tools are designed for browser extensions or automation frameworks. The browser extension matches the current URL against the pattern and executes the JavaScript handler when the tool is invoked.
API Endpoint:
GET /api/webmcp/match?url=https://www.gsmarena.com/...
Third-party clients can use the same endpoint as mcp-chrome. Execute the returned JavaScript handler in your own browser page context.