Please take off your hat.

Literal

Hat [object-を] take-[polite-request-てください]

帽子をとる is ambiguous out of context: 'to take (remove) a hat from one's head' OR 'to pick up / grab a hat'. In most real-world situations (entering a building, greeting someone) it means 'remove'. The general verb とる is polysemous — the listener parses by context.