This is a submission for the Amazon Q Developer "Quack The Code" Challenge: Exploring the Possibilities
Photo by Eaters Collective on Unsplash
What I Built
Problem to solve - "I don't like it"
Making sure that my kids will eat the lunch
In my sons' school, there are two main lunch options - you can order a meal from the catering provider, or bring your own food. Each option has its own pros and cons, but the main thing is that I cannot order lunch from the catering service whenever I want to. There is a specific menu, and kids, like everyone else, have their food preferences. Someone likes meat in all forms, someone won't touch a traditional Polish port chop
Currently, in my family, the process of "providing our kids with lunch" is more or less spontaneous:
- what is tomorrow's lunch?
- they won't eat this ...
- we don't have products to prepare lunch, I need to go for groceries ...
and so far, and so on
The solution I prepared is aimed at helping us have more control over planning meals for our kids.
Solution
As a result, I would like to create a page in my Notion
to easily track the menu for upcoming days. I will also let q
suggest some recipes for meals prepared at home.
Step 1 - Get menu
So catering service provides a well-documented API to use when getting menu ... Just kidding! Who would build APIs for the catering service?
To get the menu, I need to log in to the webpage.
q
can do this. There is a reason why the Playwright MCP Server
is probably the most popular tool in the MCP ecosystem. With Playwright
, AI agents can go and actually use the Internet.
The whole "code" is available in this GitHub repo (there is no code, just configuration and prompts)
I create mpc.json
file and add playwright
tool there:
.amazonq/mcp.json
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
Now, when I run q
, I can ask it to go to a specific page:
And after a few actions I see the video with funny cats in the browser.
In the same way, I will scrape the menu from the website using the same playwright
tool.
Let's start from the first prompt in the get_menu.md
- read catering/.env file and get CATERING_LOGIN and CATERING_PASSWORD
- go to https://www.zamow.kuchniacateringowa.pl/ and log in
- go to https://www.zamow.kuchniacateringowa.pl/Product/Menu
- click "Pokaż menu" for "SZKOŁA PODSTAWSOWA- KLASY 1-8"
- check the "II danie + zupa" and "II danie + zupa + deser" for each date and create a table in the markdown format with the following columns
- date
- main dish (keep it in Polish)
- desert (keep it in Polish)
- save the table as a <last_date_from_menu>.md in the catering/menu/ directory
Now I ask q
to read the instructions and perform actions
For some reason, sometimes the last step is not performed. I need to ask again to save the file
As a result menu is saved in the new file.
Step 2 - Analyze preferences
I decided to split the whole process into steps so I could easily rerun the specific part without going through all the steps again. Once I have the menu saved, I can analyze food preferences and iterate over different inputs.
The next prompt in the analyze_menu.mg
- go to catering/menu directory and read the file with the newest date in the title. the date needs to be not earlier than tomorrow, otherwise stop the process
- read preferences from catering/preferences directory
- check the "Main Dish" column from the menu file for each date and create a table in the markdown format with the following columns
- date
- main dish (keep it in Polish)
- desert (keep it in Polish)
- OK for dummy_name_1 (use emoji for OK, NOT, SO-SO)
- comment dummy_name_1 (based on loaded preferences, why this dish will be OK, NOT or SO-SO)
- OK for dummy_name_2 (use emoji for OK, NOT, SO-SO)
- comment dummy_name_2 (based on loaded preferences, why this dish will be OK, NOT or SO-SO)
- save the table as a <last_date_from_table>.md in the catering/analyze/ directory
I created files with preferences for each of my sons. You might wonder why they are called Dummy_name_1
and Dummy_name_2
, but hey, naming part is the hardest one, right?
Now let's ask q
to do the magic
I save the result as a markdown file, and I can review it locally.
🎉 🎉
It looks amazing already! Let's move forward
Step 3 - Upload the result to Notion
I use Notion for planning already, so it would be nice to have a result table there. Now I can check the menu with my checks anytime on my phone. And it looks nice.
Prepare Notion page
I have created a parent page in the Notion
and saved its ID.
I also created an internal integration to be able to use its token
Finally, I added integration to my target page
To interact with notion
I will use the official notion MCP. I need to update my mcp.json
file:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
},
"notionApi": {
"command": "npx",
"args": ["-y", "@notionhq/notion-mcp-server"],
"env": {
"OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer <YOUR_NOTION_TOKEN>", \"Notion-Version\": \"2022-06-28\" }"
}
}
}
}
It's time to run the q
with the following prompt from the update_notion.md
- read the file with the latest date in the title from the catering/analyze/ directory
- post page with the content from the file named as a file. parent page ID is 1eac5262835580c28f59cd9bd1e24ae1
- use Notion formatting to create a page to preserve headings and to add a table
- page should be named "Catering analysis <date_from_the_file_name>"
- if there is already a page with this name as a child of 1eac5262835580c28f59cd9bd1e24ae1, update the existing page instead of creating the new one
And there is a notion
page created
How cool is this!
I can share this page with my wife, so we both have visibility. Or with my kids and ask them to validate results, so I can improve the definition of their preferences
Step 4 - Suggest recipes
Once I know when I would probably need to prepare lunch at home, I could use some advice on the ideas for recipes.
Prompt from prepare_recipes.md
- read the file with the latest date in the title from the catering/analyze/ directory
- look for dates where the dish is not ok for at least one kid
- read preferences from catering/preferences directory
- for those days suggest recipes for dishes easy to prepare at home the day before and easy to warm up. If there are two days in the row, the recipe could use the same "base" to prepare lunches for two days
- even if there are recipes for two consecutive days, show both as a separate row in the table
- recipes should be simple and fast, e.g. without preparing dumpings, as it is time consuming
- recipes should include all macro elements needed, vegetables and meat, or other source od protein
- avoid sugar
- save recipes as a markdown table with date, recipe and ingredients. the file name should be menu/<date_from_the_analyze_file>_recipes.md
And the result
Not bad!
Summary
I used q
to solve a real problem and to make my life a bit easier. Interacting with q
via the console was fun. I really liked the ease of integrating MCP-based tools.
Not to say that the possibility to use q
with the BuilderID
for free is a super nice option!
q
deals with non-English content without any problem.
Next steps
In the future, I would like to gather information about the current offers from the shops where I used to buy groceries. I am going to use this info when planning meals.
Maybe my q
agent should just order some food for me, or at least put items in the basket in the online checkout?
Code Repository
https://github.com/szymon-szym/amazonq-plan-lunch
How I Used Amazon Q Developer
- built-in tools to read files with prompts, preferences, and
.env
with configuration and credentials - Playwright MCP to use a headless browser to access the Internet
- Notion MCP to update the page on
Notion
- LLMs behind
q
to reason about food preferences and to suggest recipes
Top comments (4)
Cool project! Thanks for sharing
Perfect example of using stuff I already use day to day to just make parents' lives easier - gotta ask, you think most people actually stick to plans like this or life just gets messy anyway?
Hi Nathan! I can't imagine a parent's life that doesn't get messy from time to time 😄
The nice thing about projects like this, is that we can throw them away if they don't make sense for us anymore
Agreed :)