3. Follow-along: Generate a graph
2m

Follow-along: Generate a graph ( 25 min)

Goal: Use an agent and mcp tools to orchestrate two REST APIs into one .

Create the schema for Space Devs

We've provided a JSON file with the Space Devs Library API endpoint, located in the LaunchLibraryAPI.json file in the local project.

  1. Open up goose and enter the following prompt to create the schema for Space Devs using the LibraryAPI.json file.

    I just started a new graph with Apollo, I'm providing the endpoint for the Space Devs Launch Library at LaunchLibraryAPI.json in the local folder. I want to get the only the important details with fields for launches. Pad information must be included with lat/long values.
  2. The agent will prompt you to confirm the plan. It will commonly ask if you want the use the spacedevs development endpoint and if you want your schema in one file. Answer yes to both.

  3. Navigate to http://localhost:4000/ where the Explorer is running.

  4. Create a using the + buttons in the Documentation panel.

    Below is an example, the agent may have structured your schema slightly differently.

    A screenshot of the sandbox running locally with example query

    Example query
    query UpcomingLaunches($limit: Int) {
    upcomingLaunches(limit: $limit) {
    id
    name
    pad {
    latitude
    longitude
    }
    }
    }
Task!

Integrate Open Weather API

  1. In goose, enter the following prompt to integrate the Open Weather API into the schema.

    Add a field-level connector on Pad.weather. Use the open weather endpoint and the OPEN_WEATHER_KEY in the env file to research and understand this API https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={OPEN_WEATHER_KEY}

    ⚠️ Warning: Using .env files when working with agents can expose your keys. This flow is not to be used for sensitive data.

  2. Navigate back to http://localhost:4000/ and your new API will have hot-reloaded.

  3. Add weather to the and click Run again to test.

    Example query
    query UpcomingLaunches($limit: Int) {
    upcomingLaunches(limit: $limit) {
    id
    name
    pad {
    weather {
    visibility
    }
    }
    }
    }
Task!

Explore the graph

  1. In the http://localhost:4000/ Sandbox, click on the Schema icon in the left hand navigation.

  2. Click on the Visualization tab. This view allows you to see the view of your schema structure including how everything is connected. This is another tool that can help you validate your agentic output.

    A screenshot of the schema visualization tool running in local sandbox

💭 Tips

This project has an Agents.md and a .goosehints file that help us give our LLM a "persona" on building a using . Prompting with words like "Generate me a connector for..." help increase the vector search hits with our MCP tools.

Here are some tips we used in creating these prompts:

Previous