Skip to main content
Glama
listings.py6.45 kB
"""Listing retrieval tools for Trade Me MCP server.""" from typing import Any from ..client import TradeMeClient async def get_listing_details( client: TradeMeClient, listing_id: int, **kwargs: Any ) -> dict[str, Any]: """ Get detailed information about a specific listing. Retrieve comprehensive details about a Trade Me listing including title, description, price, seller information, photos, and more. No authentication required. Args: listing_id: The Trade Me listing ID return_metadata: Include additional metadata (true/false) Returns: Complete listing details including all photos, description, pricing, and seller info Example: get_listing_details(listing_id=4567890123) """ params = {} if "return_metadata" in kwargs: params["return_metadata"] = str(kwargs["return_metadata"]).lower() return client.get(f"/Listings/{listing_id}.json", params=params, requires_auth=False) async def get_listing_photos( client: TradeMeClient, listing_id: int, **kwargs: Any ) -> dict[str, Any]: """ Get all photos for a specific listing. Retrieve URLs for all photos associated with a listing in various sizes. No authentication required. Args: listing_id: The Trade Me listing ID Returns: List of photo URLs in different sizes (thumbnail, list, medium, large, full) Example: get_listing_photos(listing_id=4567890123) """ return client.get(f"/Listings/{listing_id}/Photos.json", requires_auth=False) async def get_listing_questions( client: TradeMeClient, listing_id: int, **kwargs: Any ) -> dict[str, Any]: """ Get questions and answers for a specific listing. Retrieve the public Q&A thread for a listing. No authentication required. Args: listing_id: The Trade Me listing ID page: Page number for pagination rows: Number of results per page Returns: List of questions and answers with timestamps and user information Example: get_listing_questions(listing_id=4567890123, page=1, rows=20) """ params = {} if "page" in kwargs: params["page"] = kwargs["page"] if "rows" in kwargs: params["rows"] = kwargs["rows"] return client.get( f"/Listings/{listing_id}/Questions.json", params=params, requires_auth=False ) async def get_watchlist(client: TradeMeClient, **kwargs: Any) -> dict[str, Any]: """ Get the authenticated user's watchlist. Retrieve all listings the user is currently watching. Requires authentication. Args: category: Filter by category number page: Page number for pagination rows: Number of results per page (max 500) Returns: List of watched listings with details Example: get_watchlist(page=1, rows=50) """ params = {} if "category" in kwargs: params["category"] = kwargs["category"] if "page" in kwargs: params["page"] = kwargs["page"] if "rows" in kwargs: params["rows"] = min(kwargs["rows"], 500) return client.get("/MyTradeMe/Watchlist/All.json", params=params, requires_auth=True) async def add_to_watchlist( client: TradeMeClient, listing_id: int, **kwargs: Any ) -> dict[str, Any]: """ Add a listing to the authenticated user's watchlist. Watch a listing to receive notifications about price changes and bidding activity. Requires authentication. Args: listing_id: The Trade Me listing ID to watch email_option: Email notification preference (0=None, 1=Daily, 2=Immediate) Returns: Confirmation of watchlist addition Example: add_to_watchlist(listing_id=4567890123, email_option=1) """ json_data = {"ListingId": listing_id} if "email_option" in kwargs: json_data["EmailOption"] = kwargs["email_option"] return client.post( "/MyTradeMe/Watchlist/Add.json", json_data=json_data, requires_auth=True ) async def remove_from_watchlist( client: TradeMeClient, listing_id: int, **kwargs: Any ) -> dict[str, Any]: """ Remove a listing from the authenticated user's watchlist. Stop watching a listing. Requires authentication. Args: listing_id: The Trade Me listing ID to unwatch Returns: Confirmation of watchlist removal Example: remove_from_watchlist(listing_id=4567890123) """ return client.delete( f"/MyTradeMe/Watchlist/{listing_id}.json", requires_auth=True ) async def get_bidding_history( client: TradeMeClient, listing_id: int, **kwargs: Any ) -> dict[str, Any]: """ Get the bidding history for an auction listing. Retrieve all bids placed on an auction, including bid amounts and timestamps. No authentication required for public bid history. Args: listing_id: The Trade Me listing ID Returns: List of bids with amounts, timestamps, and bidder information Example: get_bidding_history(listing_id=4567890123) """ return client.get(f"/Listings/{listing_id}/Bids.json", requires_auth=False) async def get_shipping_options( client: TradeMeClient, listing_id: int, **kwargs: Any ) -> dict[str, Any]: """ Get available shipping options for a listing. Retrieve shipping methods and costs for a listing. No authentication required. Args: listing_id: The Trade Me listing ID Returns: Available shipping options with prices and delivery estimates Example: get_shipping_options(listing_id=4567890123) """ return client.get(f"/Listings/{listing_id}/ShippingOptions.json", requires_auth=False) async def get_similar_listings( client: TradeMeClient, listing_id: int, **kwargs: Any ) -> dict[str, Any]: """ Get similar or related listings. Find listings similar to the specified listing based on category and attributes. No authentication required. Args: listing_id: The Trade Me listing ID rows: Number of results to return (default: 10) Returns: List of similar listings Example: get_similar_listings(listing_id=4567890123, rows=20) """ params = {} if "rows" in kwargs: params["rows"] = kwargs["rows"] return client.get( f"/Listings/{listing_id}/SimilarListings.json", params=params, requires_auth=False )

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/giussepe198/trademe-mcp'

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