Skip to main content
Glama

get_statistics

Retrieve database statistics including record count, date range, and last update timestamp from the CVE vulnerability database.

Instructions

Get database stats (count, date range, last update)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function implementing the 'get_statistics' tool. It obtains a database connection, calls get_stats to retrieve statistics, and serializes the result to JSON.
    def tool_get_statistics() -> str: conn = get_connection() stats = get_stats(conn) return json.dumps(stats, indent=2)
  • Core helper function that queries the database for CVE count, date range, and last update metadata.
    def get_stats(conn: sqlite3.Connection) -> dict: cursor = conn.execute("SELECT COUNT(*) as total FROM cves") total = cursor.fetchone()['total'] cursor = conn.execute("SELECT MIN(published_date) as oldest, MAX(published_date) as newest FROM cves") dates = cursor.fetchone() cursor = conn.execute("SELECT value FROM metadata WHERE key = 'last_update'") last_update_row = cursor.fetchone() last_update = last_update_row['value'] if last_update_row else None return { "total_cves": total, "oldest_cve": dates['oldest'], "newest_cve": dates['newest'], "last_update": last_update }
  • Input schema definition for the get_statistics tool, specifying an empty object with no required properties.
    inputSchema={ "type": "object", "properties": {}, "required": [] }
  • Registration of the 'get_statistics' tool in the MCP server's list_tools method, including name, description, and schema.
    Tool( name="get_statistics", description="Get database stats (count, date range, last update)", inputSchema={ "type": "object", "properties": {}, "required": [] } )
  • Tool dispatch logic in the server's call_tool method that routes requests for 'get_statistics' to the handler function.
    elif name == "get_statistics": result = tool_get_statistics()

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/davidculver/cve-mcp-server'

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