Skip to main content
Glama

BrowserStack MCP server

Official
device-search.ts1.06 kB
import { customFuzzySearch } from "../../lib/fuzzy.js"; import { DeviceEntry } from "./types.js"; /** * Find matching devices by name with exact match preference. * Throws if none or multiple exact matches. */ export function findDeviceByName( devices: DeviceEntry[], desiredPhone: string, ): DeviceEntry[] { const matches = customFuzzySearch(devices, ["display_name"], desiredPhone, 5); if (matches.length === 0) { const options = [...new Set(devices.map((d) => d.display_name))].join(", "); throw new Error( `No devices matching "${desiredPhone}". Available devices: ${options}`, ); } // Exact-case-insensitive filter const exact = matches.filter( (m) => m.display_name.toLowerCase() === desiredPhone.toLowerCase(), ); if (exact.length) return exact; // If no exact but multiple fuzzy, ask user if (matches.length > 1) { const names = matches.map((d) => d.display_name).join(", "); throw new Error( `Alternative Device/Device's found : ${names}. Please Select one.`, ); } return matches; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/browserstack/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server