I want to automatically tag my Magic the Gathering cards, because tags really help with making fast commander decks. But it takes time, and I’ve probably tagged <3% of my cards. So I set out to build a solution in Replit.
After the success of the Dolmenwood Character Generator and the Dolmenwood Batch Character Generator, I was energized and thought that the next good problem to solve would be improved management of my Magic the Gathering collection for better deck creation. I thought it would be an interesting problem I could solve with software (spoiler alert: I failed). I knew twothings going in: 1/ EDHRec tags all the cards in its database, and 2/ my collection from Moxfield has all my cards. So I figured that I could automatically add tags to my cards by 1/ exporting a Moxfield .csv of my cards, running it through a program which would pull tags from EDHRec, adding those tags automatically, and then outputting the .csv for reimport. So I turned once again to Replit.
1. Before I started working, I wanted to verify that this hasn’t been done before, and got this answer from Perplexity.AI:
Moxfield cannot currently auto‑tag your collection with EDHrec-style tags; all tagging is manual or based on your own custom/global tags within Moxfield itself. There is an open feature request for automatic tagging (for things like “removal,” “boardwipe,” etc.), but it has not been implemented as a native auto‑tag or EDHrec-integration feature.
2. Good. That means I won’t be duplicating work, and will be providing a solution to a problem that many people share. With that in mind, I got to work by defining the problem in perplexity.ai:
d
3. Perplexity gave me 5 scripts, and advised me to do each one sequentially, as it is much more efficient to work by building one thing at a time. Here was the first script:

4. That worked:

5. Except when uploading, it produced a status error.

6. I prompted Replit for the fix:
After uploading a .csv, I receive the error: “AxiosError: Request failed with status code 403”
7. Replit says it’s a known issue with Streamlit’s CSRF protection, which it will work to fix. While it works, I looked up Streamlit, because I didn’t know what it was and I was curious. Apparently, it turns scripts into shareable web apps. You learn something new every day!
That seemed to work. Now it’s off to EDHRec to fetch some card tags:

8. I don’t claim to have a large collection, by any means, but that takes a while to do this, so I did some other things in the meantime. I was happy to see that at the conclusion, Replit had tagged the cards, and output them as a .csv. (Although to be fair, at this point I’m starting to wonder how much money I’m burning at Replit. I ignored this warning, and pressed on).
9. Unfortunately, in this first pass, Replit didn’t tag all the cards. Many of them were like Adrix and Nev, below. So I doublechecked on EDHRec and discovered that yes, they have tags. So it’s back to the drawing board.


10. Again, I just asked Replit about the problem, no coding needed:
The program is not tagging many of my cards. How to fix?
In response, Replit provides a fascinating answer:
Now I understand the root cause. The EDHRec API only provides a basic tags field on some cards (like “ramp”, “removal”, “draw”), and many cards simply don’t have it. I need to enrich the tagging by also extracting useful information from the card data itself — type, subtypes, color identity, and oracle text keywords. Let me rewrite the tag extraction to be much more comprehensive
The original version only relied on a single tags field from EDHRec, which many cards simply don’t have. The updated version now pulls tags from multiple sources in the API response:
- EDHRec tags — ramp, draw, removal, etc.
- Card type & subtypes — creature, instant, elf, goblin, wizard, etc.
- Color identity — white, blue, black, red, green, colorless, multicolor
- Keywords from card text — flying, trample, flashback, landfall, tokens, boardwipe, tutor, and 80+ more
- Card stats — low-cmc, high-cmc, high-salt, game-changer
Every card that EDHRec has data for will now get multiple meaningful tags.
11. After re-uploading the collection, it ran for a while (really wondering how much these experiments could cost, but so far, it’s been great). After it finished loading, I checked the file and Replit indeed fixed the error – every card was tagged.

12. Now came the next part of the test, and the most nerve racking. I needed to delete my entire Moxfield collection (which I’ve added to over the years and would take a massive amount of time to rebuild), and then replace it with the new, tagged .csv. I also have lingering questions whether these tags will be helpful. I made a complete backup of my collection first and then with a big gulp, I set off to delete my collection so that I could re-upload this new file.

13. The new, tagged collection was loaded. Now it was time to see if the tags migrated, and if so, if I could then sort collections by tag. My ultimate goal is to build a Commander deck builder in Replit, but to do that, I want to start with a full tagged collection.
14. Unfortunately, the tags didn’t migrate. The tags that you see here are tags that I had already created, which makes me think that the .csv file isn’t created in a way that Moxfield recognizes the tags. Next steps: a/ Remove the tags I had created previously; 2/ Figure out how to upload EDHRec tagging into Moxfield.

15. MAJOR snag. Should have checked this before I tried building a solution in Replit:

16. I spent time searching for workarounds, but didn’t find any. Further, no tools seem to allow you to import EDHrec tags, and EDHrec doesn’t work well as a collection manager. CONS: At this point, I have to declare this project a failure; I’m unable to accomplish the task with existing software. PROS: I’ve successfully proven that Replit can modify a .csv with data sourced from another database. This could be helpful in the future.
Leave a comment