Skip to main content
Glama
tarun7r

cricket-mcp-server

get_live_matches

Retrieve live cricket match details from Cricbuzz, including match descriptions and URLs, using the MCP server for cricket data.

Instructions

Get live cricket matches from Cricbuzz.

Returns: list: A list of dictionaries, each containing the match description and a URL. Example: [{"match": "IND vs AUS...", "url": "https://..."}]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements get_live_matches by scraping the Cricbuzz live scores page to extract and return a list of currently live cricket matches with their descriptions and URLs.
    @mcp.tool() def get_live_matches() -> list: """Get live cricket matches from Cricbuzz. Returns: list: A list of dictionaries, each containing the match description and a URL. Example: [{"match": "IND vs AUS...", "url": "https://..."}] """ link = "https://www.cricbuzz.com/cricket-match/live-scores" try: response = requests.get(link, headers=HEADERS, timeout=10) response.raise_for_status() # Raise an exception for bad status codes source = response.text page = BeautifulSoup(source, "lxml") container = page.find("div", id="page-wrapper") if not container: return [{"error": "Could not find the main page wrapper"}] matches = container.find_all("div", class_="cb-mtch-lst") live_matches = [] for match in matches: description_tag = match.find("a", class_="text-hvr-underline") if description_tag: match_text = description_tag.text.strip() url_suffix = description_tag.get("href") if url_suffix: url = "https://www.cricbuzz.com" + url_suffix live_matches.append({"match": match_text, "url": url}) return live_matches except requests.exceptions.ConnectionError as e: return [{"error": f"Connection error: {str(e)}"}] except requests.exceptions.Timeout as e: return [{"error": f"Request timeout: {str(e)}"}] except requests.exceptions.HTTPError as e: return [{"error": f"HTTP error: {str(e)}"}] except Exception as e: return [{"error": f"Failed to get live matches: {str(e)}"}]
  • The @mcp.tool() decorator registers the get_live_matches function as an MCP tool.
    @mcp.tool()
  • The docstring provides the schema description for the tool's input (none) and output (list of dicts with 'match' and 'url').
    """Get live cricket matches from Cricbuzz. Returns: list: A list of dictionaries, each containing the match description and a URL. Example: [{"match": "IND vs AUS...", "url": "https://..."}] """
  • Reference to get_live_matches in the docstring of the get_match_details tool.
    match_url (str): The URL of the match on Cricbuzz (can be obtained from get_live_matches).

Other Tools

Related Tools

Latest Blog Posts

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/tarun7r/cricket-mcp-server'

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