@Hungryhungryhippos
I would avoid the Mercado de San Miguel with a baby, as it can be incredibly crowded with no place to sit. It’s become a major tourist magnet, I’m afraid, packed to the rafters at all times.
For market grazing, I´d head to the authentic and wonderful MERCADO DE LA PAZ in the Salamanca quarter to stroll around and have a tortilla at Casa Dani with outdoor table seating at the Lagasca street entrance.
The fine gastro bars of the Retiro district also get jam packed, especially on weekends, when reservations are absolutely essential.
Half of “foodie Madrid” was at La Catapa this weekend, and I’ve never seen children there, or at any of the others that I love there with outdoor terraces (La Montería, Laredo, La Monte, Castelados), so I can’t enthusiastically recommend a food crawl there with a small child. They just get too busy and usually couples only or groups of couples.
The 2 exceptions would be KULTO and MERCADO DE IBIZA on Calle Ibiza in the Retiro district. Calle Ibiza has a wide center walkway, with terraces with low tables and attracts families. KULTO excels in tuna dishes.
In the Salamanca district on restaurant lined Calle Jorge Juan there´s the Galician OCAFÚ, with outdoor terrace, moderate prices for this posh street and nice albariño wines by the glass.
We also see children at LA MÁQUINA on Jorge Juan with outdoor terrace.
The restaurants there do add a surcharge for terrace dining.
https://ocafu.com
https://lamaquinajorgejuan.es.
For large outdoor terraces with a casual atmosphere, low table seating instead of high tables and with a baby in tow, I’d also consider the informal space of Florida Park, inside Retiro Park.
The Real Jardín Botánico (botanical garden) now has a café, next to the Prado.
Behind the Prado, there´s the popular Murillo Café, that has a nice outdoor terrace. Ditto to el 17 Moreto around the corner… Again, to early when they open as they get very crowded.
https://murillocafe.com
In Letras/Huertas, there´s the lively Plaza Santa Ana with its playground and lined with a dozen casual eateries, but not many serving distinguished food, although Ana La Santa in the Hotel ME with terrace is a fairly safe bet.
https://grupotragaluz.com/en/restaurants/ana-la-santa/.
Near the Plaza del Carmen?
Are you staying at the new The Thompson or the old Liabeny?
If you´re staying at the former, they’ve just inaugurated their summer only rooftop terrace, El Cielo de Hijos de Tomás on the 8th floor, with terrific views. I just got a tour. Live music at night. If the concierge can provide baby sitting services for a few hours…
https://www.hijosdetomas.com/elcielodehijosdetomas/.
And as PedroPero says, it´s blazing hot in Madrid in July, so you´ll need shade and misters.