Skip to main content
Lesson 7 of 18·7 min

Fetch Live Data

You've already got park lookup working—now you'll take the next step and make the theme park agent genuinely helpful. In this lesson, you'll add a new capability that pulls a live snapshot of what's happening in a park right now.

You'll create a tool that accepts a park ID and returns a curated list of attractions with key fields like location/land, open status, and current posted wait time. You'll also ensure the results are sorted so the shortest waits rise to the top, making the output immediately usable for recommendations.

This matters because live park conditions change quickly, and the agent needs fresh, structured data to plan a realistic route through the day. You'll also wire the tool into the agent and test the full "lookup → live snapshot" chain inside Mastra Studio, so the agent consistently calls the right tool at the right time.

"Wait times change fast—so always return when you fetched the data. That timestamp makes the snapshot trustworthy."

— Guil Hernandez

Mentioned in the Lesson
Direct link to Mentioned in the Lesson

Code:

Relevant Mastra docs:

Join the Community
Direct link to Join the Community

Ask questions:

Follow Mastra:

  • X — follow Mastra for updates
  • YouTube — watch more tutorials
  • LinkedIn — follow for updates

Don’t miss the next Mastra lessons

Be notified the moment new lessons release and stay ahead of every update. We’ll email you about course improvements, new Mastra features, and upcoming live workshops. Unsubscribe anytime.