Skip to main content
Glama
Fewsats
by Fewsats

get_purchase_offers

Retrieve payment options for domain purchases, including L402 offer details like cost, currency, and package information for processing.

Instructions

Request available payment options for a domain. This method returns an L402 offer, which includes details such as offer_id, amount, currency, and more. The returned offer can be processed by any tool supporting L402 offers. The TLD .ai mandates a minimum registration and renewal period of two years. So inform the user that they need to purchase a 2 year package when they request a .ai domain. The L402 offer structure: { 'offers': [ { 'offer_id': 'example_offer_id', # String identifier for the offer 'amount': 100, # Numeric cost value in USD cents 'currency': 'usd', # Currency code 'description': 'Example offer', # Text description 'title': 'Example Package' # Title of the package } ], 'payment_context_token': 'example_token', # Payment context token 'payment_request_url': 'https://api.example.com/payment-request', # Payment URL 'version': '0.2.2' # API version } sid: Search ID from a previous search request domain: Domain name to purchase from the search results related to `sid`

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sidYes
domainYes

Implementation Reference

  • MCP tool handler and registration for 'get_purchase_offers'. This async function handles the tool execution, includes input schema via type hints and detailed docstring describing parameters and expected L402 offer output structure, and delegates the core logic to the Sherlock instance's _get_purchase_offers method.
    @mcp.tool() async def get_purchase_offers(sid: str, domain: str): """ Request available payment options for a domain. This method returns an L402 offer, which includes details such as offer_id, amount, currency, and more. The returned offer can be processed by any tool supporting L402 offers. The TLD .ai mandates a minimum registration and renewal period of two years. So inform the user that they need to purchase a 2 year package when they request a .ai domain. The L402 offer structure: { 'offers': [ { 'offer_id': 'example_offer_id', # String identifier for the offer 'amount': 100, # Numeric cost value in USD cents 'currency': 'usd', # Currency code 'description': 'Example offer', # Text description 'title': 'Example Package' # Title of the package } ], 'payment_context_token': 'example_token', # Payment context token 'payment_request_url': 'https://api.example.com/payment-request', # Payment URL 'version': '0.2.2' # API version } sid: Search ID from a previous search request domain: Domain name to purchase from the search results related to `sid` """ return handle_response(get_sherlock()._get_purchase_offers(sid, domain))
  • Helper function used by get_purchase_offers (and other tools) to standardize responses from Sherlock methods, handling both raw HTTP responses and pre-processed data.
    def handle_response(response): """ Handle responses from Sherlock methods. Sherlock methods already process the response using _handle_response, which returns either a processed JSON object for successful requests or the response object itself. """ if hasattr(response, 'status_code'): # This is a raw response object try: return response.status_code, response.json() except: return response.status_code, response.text # This is already processed data (like a dictionary) return response
  • Helper function to lazily instantiate the Sherlock class, used by get_purchase_offers to access the _get_purchase_offers method.
    def get_sherlock(): """Get or create a Sherlock instance. We want to create the class instance inside the tool, so the init errors will bubble up to the tool and hence the MCP client instead of silently failing during the server creation. """ return Sherlock()

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/Fewsats/sherlock-mcp'

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