�
#֘h& � �� � d dl mZ d dlZd dlmZ d dl� d dlZd dlmZ e� ed� Z e j � defd�� Ze
d k( re j d
�� yy)� )�AnyN)�FastMCP)�*)�load_dotenvzcar_retail_company database�queryc � �R K � t | � \ }}t t | ||� � S �w)a0
runs the query on car_retail_company database.
the database has one table called cars.
the following is the database schema:
'
cars (
car_id INT AUTO_INCREMENT PRIMARY KEY,
brand VARCHAR(50) NOT NULL,
model VARCHAR(50) NOT NULL,
color VARCHAR(30) NOT NULL,
car_condition ENUM('new', 'used', 'certified_pre_owned') NOT NULL,
mileage INT NOT NULL,
price DECIMAL(10, 2) NOT NULL,
owner_email VARCHAR(100) NOT NULL,
date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX (brand),
INDEX (model),
INDEX (price)
'
Parameters:
- query: the query which is run on the database
returns:
dict: A structured response with metadata and formatted data
)�execute_mysql_query�str�format_results_for_llm)r �results�descriptions �0/mnt/c/Users/abbas/Documents/MCPServer/server.py� run_queryr s, � �� �: /�u�5��G�[��%�e�G�[�A�B�B�s �%'�__main__�stdio)� transport)�typingr �httpx�mcp.server.fastmcpr �db�os�dotenvr �mcp�toolr
r �__name__�run� � r �<module>r si �� � � &� � � � �
�
�+�,������C�#� C� �C�B �z���G�G�g�G�� r