get_purchase_offers
Retrieve payment options and L402 offer details for purchasing a specific domain. Includes cost, currency, and package information, ensuring compliance with .ai domain’s 2-year requirement.
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
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | ||
| sid | Yes |
Implementation Reference
- src/sherlock_mcp/server.py:102-130 (handler)The primary handler function for the 'get_purchase_offers' MCP tool, decorated with @mcp.tool() for registration. It takes sid and domain parameters, includes detailed docstring describing input/output schema, and delegates execution to Sherlock._get_purchase_offers via helper functions.@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))
- src/sherlock_mcp/server.py:19-30 (helper)Helper function used by get_purchase_offers to standardize responses from Sherlock methods.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
- src/sherlock_mcp/server.py:10-16 (helper)Helper function used by get_purchase_offers to lazily instantiate the Sherlock core class.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()