mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-17 06:58:09 +01:00
Model Context Protocol (MCP) support with new use case (#42)
* initial mcp * food ordering with mcp * prompt eng * splitting out goals and updating docs * a diff so I can get tests from codex * a diff so I can get tests from codex * oops, missing files * tests, file formatting * readme and setup updates * setup.md link fixes * readme change * readme change * readme change * stripe food setup script * single agent mode default * prompt engineering for better multi agent performance * performance should be greatly improved * Update goals/finance.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update activities/tool_activities.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * co-pilot PR suggested this change, and now fixed it * stronger wording around json format response * formatting * moved docs to dir * moved image assets under docs * cleanup env example, stripe guidance * cleanup --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1811e4cf59
commit
5d55a9fe80
33
tools/food/add_to_cart.py
Normal file
33
tools/food/add_to_cart.py
Normal file
@@ -0,0 +1,33 @@
|
||||
def add_to_cart(args: dict) -> dict:
|
||||
"""
|
||||
Simple stateless cart tool for demo purposes.
|
||||
In production, this would use proper session storage or database.
|
||||
"""
|
||||
customer_email = args.get("customer_email")
|
||||
item_name = args.get("item_name")
|
||||
item_price = float(args.get("item_price", 0))
|
||||
quantity = int(args.get("quantity", 1))
|
||||
stripe_product_id = args.get("stripe_product_id")
|
||||
|
||||
# Basic validation
|
||||
if not customer_email:
|
||||
return {"error": "Customer email is required"}
|
||||
if not item_name:
|
||||
return {"error": "Item name is required"}
|
||||
if item_price <= 0:
|
||||
return {"error": "Item price must be greater than 0"}
|
||||
if quantity <= 0:
|
||||
return {"error": "Quantity must be greater than 0"}
|
||||
|
||||
# For demo purposes, just acknowledge the addition
|
||||
# In a real system, this would store to session/database
|
||||
return {
|
||||
"status": "success",
|
||||
"message": f"Added {quantity} x {item_name} (${item_price}) to cart for {customer_email}",
|
||||
"item_added": {
|
||||
"name": item_name,
|
||||
"price": item_price,
|
||||
"quantity": quantity,
|
||||
"stripe_product_id": stripe_product_id,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user