from headroom.compression import UniversalCompressor, UniversalCompressorConfig # Initialize a custom local compressor config = UniversalCompressorConfig( compression_ratio_target=0.3, # Aim for 70% reduction use_entropy_preservation=True # Ensure your exact tool names/keys aren't mangled ) compressor = UniversalCompressor(config) raw_tool_definitions = """ { "type": "function", "function": { "name": "ping", "description": "Measure network latency, packet loss, and reachability to a target (domain or IP) from globally distributed probes. Use this tool to check if a server is online, debug connection issues, or assess global performance. Note: Only public endpoints are supported. Private networks cannot be tested.", "parameters": { "type": "object", "properties": { "target": { "type": "string", "description": "Public domain name or IP address to test (e.g., 'google.com', '1.1.1.1'). Private IPs (RFC1918), localhost, and link-local addresses are not supported." }, "locations": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "string" } ], "description": "Specific locations to run the test from using the Globalping magic field syntax. Use 'world' to select a diverse set of probes globally. It supports Globalping magic field syntax: ['US', 'Europe', 'AS13335', 'London+UK', 'Amazon+Germany', 'Greece']. You can also use a previous measurement ID to compare results with the same probes." }, "limit": { "type": "number", "minimum": 1, "maximum": 100, "description": "Number of probes to use (default: 3, max: 100)" }, "packets": { "type": "number", "description": "Number of packets to send (default: 3)" }, "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "target", "context" ], "$schema": "http://json-schema.org/draft-07/schema#" } } } { "type": "function", "function": { "name": "traceroute", "description": "Trace the network path to a target (domain or IP) from global locations. Use this tool to identify where packets are being dropped, analyze routing paths, or pinpoint latency sources in the network. Note: Only public endpoints are supported. Private networks cannot be tested.", "parameters": { "type": "object", "properties": { "target": { "type": "string", "description": "Public domain name or IP address to test (e.g., 'cloudflare.com', '1.1.1.1'). Private IPs (RFC1918), localhost, and link-local addresses are not supported." }, "locations": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "string" } ], "description": "Specific locations to run the test from using the Globalping magic field syntax. Use 'world' to select a diverse set of probes globally. It supports Globalping magic field syntax: ['US', 'Europe', 'AS13335', 'London+UK', 'Amazon+Germany', 'Greece']. You can also use a previous measurement ID to compare results with the same probes." }, "limit": { "type": "number", "minimum": 1, "maximum": 100, "description": "Number of probes to use (default: 3, max: 100). Higher limits provide more diverse results when using 'world' location." }, "protocol": { "type": "string", "enum": [ "ICMP", "TCP", "UDP" ], "description": "Protocol to use (default: ICMP)" }, "port": { "type": "number", "description": "Port number for TCP/UDP (default: 80)" }, "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "target", "context" ], "$schema": "http://json-schema.org/draft-07/schema#" } } } { "type": "function", "function": { "name": "dns", "description": "Resolve DNS records (A, AAAA, MX, etc.) for a domain from global locations. Use this tool to verify DNS propagation, troubleshoot resolution failures, or check if users in different regions are seeing the correct records. Note: Only public endpoints are supported. Private networks cannot be tested.", "parameters": { "type": "object", "properties": { "target": { "type": "string", "description": "Public domain name to resolve (e.g., 'google.com'). Private domains, localhost, and link-local addresses are not supported." }, "locations": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "string" } ], "description": "Specific locations to run the test from using the Globalping magic field syntax. Use 'world' to select a diverse set of probes globally. It supports Globalping magic field syntax: ['US', 'Europe', 'AS13335', 'London+UK', 'Amazon+Germany', 'Greece']. You can also use a previous measurement ID to compare results with the same probes." }, "limit": { "type": "number", "minimum": 1, "maximum": 100, "description": "Number of probes to use (default: 3, max: 100). Higher limits provide more diverse results when using 'world' location." }, "queryType": { "type": "string", "enum": [ "A", "AAAA", "ANY", "CNAME", "DNSKEY", "DS", "HTTPS", "MX", "NS", "NSEC", "PTR", "RRSIG", "SOA", "TXT", "SRV", "SVCB" ], "description": "DNS record type (default: A)" }, "resolver": { "type": "string", "description": "Custom resolver to use (e.g., '1.1.1.1', '8.8.8.8')" }, "trace": { "type": "boolean", "description": "Trace delegation path from root servers (default: false)" }, "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "target", "context" ], "$schema": "http://json-schema.org/draft-07/schema#" } } } { "type": "function", "function": { "name": "http", "description": "Send HTTP/HTTPS requests (GET, HEAD or OPTIONS) to a URL from global locations. Use this tool to check website uptime, verify response status codes, analyze timing (TTFB, download), and debug CDN or caching issues. Note: Only public endpoints are supported. Private networks cannot be tested.", "parameters": { "type": "object", "properties": { "target": { "type": "string", "description": "Public domain name or IP address to test (e.g., 'example.com'). Private IPs (RFC1918), localhost, and link-local addresses are not supported." }, "locations": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "string" } ], "description": "Specific locations to run the test from using the Globalping magic field syntax. Use 'world' to select a diverse set of probes globally. It supports Globalping magic field syntax: ['US', 'Europe', 'AS13335', 'London+UK', 'Amazon+Germany', 'Greece']. You can also use a previous measurement ID to compare results with the same probes." }, "limit": { "type": "number", "minimum": 1, "maximum": 100, "description": "Number of probes to use (default: 3, max: 100). Higher limits provide more diverse results when using 'world' location." }, "method": { "type": "string", "enum": [ "GET", "HEAD", "OPTIONS" ], "description": "HTTP method (default: GET)" }, "protocol": { "type": "string", "enum": [ "HTTP", "HTTPS" ], "description": "Protocol to use (default: HTTPS)" }, "path": { "type": "string", "description": "Path component of the URL (e.g., '/api/v1/status')" }, "port": { "type": "number", "description": "Port number (default: 443 for HTTPS, 80 for HTTP)" }, "query": { "type": "string", "description": "Query string (e.g., 'param=value&another=123')" }, "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "target", "context" ], "$schema": "http://json-schema.org/draft-07/schema#" } } } { "type": "function", "function": { "name": "locations", "description": "Retrieve the list of available Globalping probe locations. Use this tool to find specific countries, cities, or ASNs to use as the 'locations' argument in other measurement tools. Avoid using this tool unless absolutely necessary, instead simply provide the location you need to the tools above, the field is smart and will auto select the right probes.", "parameters": { "type": "object", "properties": { "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "context" ] } } } { "type": "function", "function": { "name": "mtr", "description": "Run an MTR (My Traceroute) diagnostic, which combines Ping and Traceroute. Use this tool to analyze packet loss and latency trends at every hop in the network path over time, helpful for spotting intermittent issues. Note: Only public endpoints are supported. Private networks cannot be tested.", "parameters": { "type": "object", "properties": { "target": { "type": "string", "minLength": 1, "description": "Public destination hostname or IP address to run the MTR against. Private IPs (RFC1918), localhost, and link-local addresses are not supported." }, "locations": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "string" } ], "description": "Specific locations to run the test from using the Globalping magic field syntax. Use 'world' to select a diverse set of probes globally. It supports Globalping magic field syntax: ['US', 'Europe', 'AS13335', 'London+UK', 'Amazon+Germany', 'Greece']. You can also use a previous measurement ID to compare results with the same probes." }, "limit": { "type": "number", "minimum": 1, "maximum": 100, "description": "Number of probes to use (default: 3, max: 100). Higher limits provide more diverse results when using 'world' location." }, "protocol": { "type": "string", "enum": [ "ICMP", "TCP", "UDP" ], "description": "Protocol to use (default: ICMP)" }, "port": { "type": "number", "description": "Port number for TCP/UDP (default: 80)" }, "packets": { "type": "number", "description": "Number of packets to send to each hop (default: 3)" }, "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "target", "context" ], "$schema": "http://json-schema.org/draft-07/schema#" } } } { "type": "function", "function": { "name": "limits", "description": "Check current API rate limits and remaining credits. Use this tool to monitor your usage quota and verify if you can perform additional measurements.", "parameters": { "type": "object", "properties": { "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "context" ] } } } { "type": "function", "function": { "name": "getMeasurement", "description": "Retrieve the full details of a past measurement using its ID. Use this tool to access raw JSON data, individual probe results, or cached measurements when the initial summary is insufficient.", "parameters": { "type": "object", "properties": { "id": { "type": "string", "description": "The ID of a previously run measurement (e.g., '01HT4DGF5ZS7B2M93QP5ZTS3DN')" }, "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "id", "context" ], "$schema": "http://json-schema.org/draft-07/schema#" } } } { "type": "function", "function": { "name": "compareLocations", "description": "Get a guide on how to run comparison tests using the exact same probes as a previous measurement. Use this tool when you need to benchmark different targets from the same vantage points.", "parameters": { "type": "object", "properties": { "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "context" ] } } } { "type": "function", "function": { "name": "help", "description": "Get a comprehensive guide to the Globalping MCP server. Use this tool to learn about available tools, understand location formatting (magic fields), or see example usage patterns.", "parameters": { "type": "object", "properties": { "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "context" ] } } } { "type": "function", "function": { "name": "authStatus", "description": "Check the current authentication status. Use this tool to verify if the user is logged in and has a valid token for executing measurements.", "parameters": { "type": "object", "properties": { "context": { "type": "string", "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"" } }, "required": [ "context" ] } } } { "type": "function", "function": { "name": "get_more_tools", "description": "Check for additional tools whenever your task might benefit from specialized capabilities - even if existing tools could work as a fallback.", "parameters": { "type": "object", "properties": { "context": { "type": "string", "description": "A description of your goal and what kind of tool would help accomplish it." } }, "required": [ "context" ] } } } """