Skip to main content
Glama

get_earthquake_news

Fetch earthquake news for specific locations and date ranges to monitor seismic activity and stay informed about recent events.

Instructions

Fetch earthquake news for a given location within a specified date range.

Args:
    location: Name or identifier of the place where the earthquake(s) occurred.
    date_start: The earliest timestamp in the form of <YYYY-MM-DD HH:mm:ss> (inclusive) to start searching for earthquake news. If omitted, defaults to the current date.
    date_end: The latest timestamp in the form of <YYYY-MM-DD HH:mm:ss> (inclusive) to stop searching for earthquake news. If omitted, defaults to the current date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYes
datetime_startNo
datetime_endNo

Implementation Reference

  • The core handler function decorated with @mcp.tool() for registration. It handles input validation, makes API request to fetch earthquake data, and formats output using helpers.
    @mcp.tool()
    async def get_earthquake_news(location: str, datetime_start: str = None, datetime_end: str = None) -> str:
        """Fetch earthquake news for a given location within a specified date range.
    
        Args:
            location: Name or identifier of the place where the earthquake(s) occurred.
            date_start: The earliest timestamp in the form of <YYYY-MM-DD HH:mm:ss> (inclusive) to start searching for earthquake news. If omitted, defaults to the current date.
            date_end: The latest timestamp in the form of <YYYY-MM-DD HH:mm:ss> (inclusive) to stop searching for earthquake news. If omitted, defaults to the current date.
        """
        if not datetime_start:
            datetime_start = current_date() + " 00:00:01"
        elif not validate_datetime(datetime_start):
            return "Wrong `datetime_start` format given. Accepted format is 'YYYY-MM-DD HH:mm:ss'."
    
        if not datetime_end:
            datetime_end = current_date() + " 23:59:59"
        elif not validate_datetime(datetime_end):
            return "Wrong `datetime_end` format given. Accepted format is 'YYYY-MM-DD HH:mm:ss'."
    
        earthquake_url = f"{GOV_API_BASE}/weather/warning/earthquake"
        data = await make_api_request(earthquake_url, {
                                        "meta": "true",
                                        "sort": "-utcdatetime",
                                        "timestamp_start": f"{datetime_start}@utcdatetime",
                                        "timestamp_end": f"{datetime_end}@utcdatetime",
                                        "icontains": f"{location}@location"
                                    })
    
        if not data or "data" not in data:
            return "Unable to fetch earthquake news or no earthquake news found."
    
        if not data["data"]:
            return "No active earthquake news for this location."
    
        earthquakes = [format_earthquake_data(earthquake_desc) for earthquake_desc in data["data"]]
        return "\n---\n".join(earthquakes)
  • Supporting function that formats individual earthquake data records into human-readable strings, called by the handler.
    def format_earthquake_data(earthquake_res: dict) -> str:
        """Format an earthquake news into a readable string."""
        return f"""
    UTC Datetime: {earthquake_res.get('utcdatetime', 'Unknown')}
    Local Datetime: {earthquake_res.get('localdatetime', 'Unknown')}
    Latitude: {earthquake_res.get('lat', 'Unknown')}
    Longitude: {earthquake_res.get('lon', 'Unknown')}
    Depth: {earthquake_res.get('depth', 'Unknown')}
    Location: {earthquake_res.get('location', 'Unknown')}
    Default Magnitude: {earthquake_res.get('magdefault', 'Unknown')}
    Default Magnitude Type: {earthquake_res.get('magtypedefault', 'Unknown')}
    Status: {earthquake_res.get('status', 'Unknown')}
    Distance/direction to a Malaysian location: {earthquake_res.get('n_distancemas', 'Unknown')}
    Distance/direction to a non-Malaysian location: {earthquake_res.get('n_distancerest', 'Unknown')}
    """
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions fetching news but doesn't describe what 'news' entails (e.g., articles, alerts, data points), potential rate limits, authentication needs, or error handling. The description lacks details on return format, pagination, or data freshness, leaving significant gaps for an agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the purpose stated clearly in the first sentence. The parameter explanations are concise and directly relevant, avoiding unnecessary details. However, the formatting with 'Args:' and bullet-like indentation could be slightly more streamlined, but it remains efficient overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is partially complete. It covers the purpose and parameter semantics adequately but lacks behavioral details like output structure, error cases, or usage guidelines relative to siblings. Without annotations or output schema, more context on what 'news' returns would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantics beyond the input schema, which has 0% description coverage. It explains that 'location' is a 'Name or identifier of the place where the earthquake(s) occurred,' clarifies timestamp formats for date parameters, and specifies default behaviors (e.g., defaults to current date if omitted). This compensates well for the schema's lack of descriptions, though it doesn't cover all nuances like valid location formats.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Fetch earthquake news for a given location within a specified date range.' It specifies the verb ('fetch'), resource ('earthquake news'), and scope ('location within date range'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'get_warning' or 'get_weather_forecast', which might also involve location-based data retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools or clarify scenarios where 'get_earthquake_news' is preferred over 'get_warning' or 'get_water_level_condition', nor does it specify prerequisites or exclusions. Usage is implied only through the purpose statement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/yting27/weather-my-mcp'

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