I want to share something that happened a few weeks ago, which I am still wondering about.
There were two events:
In the first time, in a dungeon, we found several imp-like creatures on a room with red-blood like floor, poisonous on contact. We didn't know anything other than the fact they were imps. Suddenly, I remembered that my Cleric's secret from the XGtE (that text to make flavour on characters) was "An imp offers you counsel. You try to ignore the creature, but sometimes its advice is helpful." So I asked to my DM if I could request help from him, and my imp told us that those creatures weren't imps, but ooze. That saved us a lot of time.
The second time, we won a fight in a coliseum and they rewarded us with a magic item. Since it was my first +1 hammer I wanted to make it special. I am a forge cleric, with a clan crafter background, that gives me a chisel. So I decided to inscribe the emblem of my deity on it to show my devotion, even when that would take me a full hour. That night we fought again in the coliseum and I lost the Wisdom saving throw of an enemy's command spell, dropping my hammer and shield. Since I couldn't afford to spend a whole action to equip the shield again, I decided to only equip the hammer, and then my DM said: "You lose your shield which was your holy symbol. Normally you wouldn't be able to cast spells with a material component, but a few hours ago you asked me to inscribe the symbol of your god in the weapon, so now that hammer works as a holy symbol also". That was great.
Both things don't exist on rules. There isn't a rule about how to craft a holy symbol, how to use a chisel, nor the mechanical rules of every trait a character can have, like a secret imp which gives you advice. All that stuff was improvised by the DM, so my question is: Up to which point does narrative, roleplaying or just flavour text can affect the mechanics of D&D 5e? Does D&D 5e (DMG?) have a rule about ruling on the fly that stuff? How can a DM know if they are exceeding the limits or just applying what the books can't say because that would take too many pages to write?
For example, using the hammer as a holy symbol doesn't affect the rules much (I think) because I will still use the shield, I want that AC bonus. But if instead of inscribing a holy symbol to a hammer, a Wizard bladesinger incrusted the gem of their wand to a short sword, and then used two-weapon fighting with another short sword while doing a bladesong it would be quite powerful (wouldn't it?). So there are limits on what you can and can not allow. I want to know about that.
The question may be quite at the limit of a QA style, if you think I exceeded it and this is too opinion based or too broad just let me know in comments and I'll delete it as soon as I read the comment.