search-flights
Skill0 starsChanged 4 months agoMITView on GitHub
Search Google Flights for airfares using browser automation via the Playwright MCP server (pi-mcp-adapter). Accepts origin, destination, and date range, then returns results formatted as a markdown table. Use when the user asks to search for flights, compare airfares, or find cheap flights.
In this repository10 other files it gives its agents.
- arch-auditSkill
- check-pacman-updatesSkill
- embeddings-ingestSkill
- embeddings-querySkill
- lease-hackrSkill
- perf-optimizationSkill
- pr-reviewSkill
- search-reposSkill
- security-auditSkill
- summarize-repo-changesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 14 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Search Google Flights using headless browser automation through the Playwright MCP server, accessed via the pi-mcp-adapter mcp() tool.
- Distinctive: line 14
Add the official Playwright MCP server to your MCP config.
- Very specific: line 51
All Playwright MCP tools use the playwright_browser_* prefix:
- Very specific: line 112
Call via the /skill:search-flights command, or load this skill and follow the steps below.
- Distinctive: line 133
Wait for the page to load, then take a snapshot:
- Distinctive: line 213
If a return date was provided, the calendar is still open.
- Distinctive: line 219
After selecting, click the "Done" button (look for button with text "Done") to close the calendar, or click outside the dialog.
- Distinctive: line 235
Wait for results to load (3-8 seconds).
- Distinctive: line 286
If Google blocks automated access:
- Distinctive: line 288
If a captcha appears, take a screenshot and ask the user to solve it
- Distinctive: line 289
Consider adding longer delays between interactions
- Distinctive: line 295
Look for a "Next" button at the bottom of the calendar
- Distinctive: line 300
If you get "Ref eXXX not found" errors:
- Distinctive: line 302
Always snapshot before clicking/typing
- Distinctive: line 306
If the default origin isn't what you need:
- Distinctive: line 316
Wait briefly, then snapshot again for new results
- Distinctive: line 332
Wait for results (evaluate delay)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Search Flights
Search Google Flights using headless browser automation through the Playwright MCP server, accessed via the pi-mcp-adapter mcp() tool.
Prerequisites
1. Configure the MCP Server
Add the official Playwright MCP server to your MCP config. Use one of these files:
- User-global:
~/.config/mcp/mcp.json(shared across tools) - Pi global:
~/.pi/agent/mcp.json(Pi-specific) - Project-local:
.mcp.json(project-specific)
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}The default lifecycle: "lazy" means the server starts on first tool call and idles after 10 minutes.
2. Install Playwright Browsers
The MCP server needs browser binaries. Install Chromium (default):
npx playwright install chromiumSystem dependencies may be required on Linux:
npx playwright install-deps chromiumCore Concepts
Tool Naming
All Playwright MCP tools use the playwright_browser_* prefix:
| Old Name (wrong) | Correct Name |
playwright_playwright_navigate | playwright_browser_navigate |
playwright_playwright_click | playwright_browser_click |
playwright_playwright_fill | playwright_browser_type |
playwright_playwright_press_key | playwright_browser_press_key |
playwright_playwright_evaluate | playwright_browser_evaluate |
playwright_playwright_screenshot | playwright_browser_take_screenshot |
playwright_playwright_get_visible_text | playwright_browser_snapshot |
playwright_playwright_close | playwright_browser_close |
The Snapshot-Ref Workflow (Critical)
The Playwright MCP does not use CSS selectors. Instead it uses an accessibility snapshot with element refs:
- Always take a snapshot first:
mcp({ tool: "playwright_browser_snapshot", args: '{}' }) - Read the snapshot — every interactive element has a
ref=eXXXidentifier (e.g.,ref=e92) - Use that ref number as the
targetin subsequent actions (e.g.,target: "e92") - After every interaction, take a new snapshot — refs are reassigned on every page change
Key Tool Signatures
Navigate:
mcp({ tool: "playwright_browser_navigate", args: '{"url": "https://www.google.com/travel/flights"}' })Click (uses snapshot refs, NOT CSS selectors):
mcp({ tool: "playwright_browser_click", args: '{"element": "human-readable description", "target": "e123"}' })Type text (use slowly: true for autocomplete fields):
mcp({ tool: "playwright_browser_type", args: '{"element": "description", "target": "e123", "text": "Rome", "slowly": true}' })Press a key:
mcp({ tool: "playwright_browser_press_key", args: '{"key": "Enter"}' })Take a screenshot:
mcp({ tool: "playwright_browser_take_screenshot", args: '{"name": "results", "fullPage": true, "savePng": true}' })Close browser:
mcp({ tool: "playwright_browser_close", args: '{}' })Evaluate JS (requires function param, NOT script):
mcp({ tool: "playwright_browser_evaluate", args: '{"function": "() => document.title"}' })Usage
Call via the /skill:search-flights command, or load this skill and follow the steps below.
Input Parameters
| Parameter | Required | Example | Description |
from | Yes | SFO, Newark, LHR | Airport code or city name |
to | Yes | JFK, Rome, CDG | Airport code or city name |
departDate | Yes | 2026-06-15 | Departure date (YYYY-MM-DD) |
returnDate | No | 2026-06-22 | Return date (YYYY-MM-DD). Omit for one-way |
passengers | No | 2 | Number of passengers (default: 1) |
class | No | economy, premium, business, first | Cabin class (default: economy) |
Step-by-Step Procedure
Step 1: Navigate to Google Flights
mcp({ tool: "playwright_browser_navigate", args: '{"url": "https://www.google.com/travel/flights"}' })Wait for the page to load, then take a snapshot:
mcp({ tool: "playwright_browser_snapshot", args: '{}' })Step 2: Fill in Origin (From)
- Snapshot the page to find the origin combobox ref. Look for
comboboxwith name containing "Where from?" or the default city. - Click the origin combobox — this opens a dialog with airport options:
mcp({ tool: "playwright_browser_click", args: '{"element": "Where from? origin combobox", "target": "eXXX"}' })- Snapshot again — the dialog now shows a search combobox and listbox of suggestions.
- Type the city/airport into the search combobox (use
slowly: true):
mcp({ tool: "playwright_browser_type", args: '{"element": "origin search combobox", "target": "eXXX", "text": "Newark", "slowly": true}' })- Snapshot again — the listbox now shows filtered results.
- Click the correct airport option (look for the
optionelement with the airport name):
mcp({ tool: "playwright_browser_click", args: '{"element": "Newark Liberty International Airport EWR option", "target": "eXXX"}' })Step 3: Fill in Destination (To)
- Snapshot the page to find the destination combobox ref. Look for
comboboxwith name "Where to?". - Click the destination combobox:
mcp({ tool: "playwright_browser_click", args: '{"element": "Where to? destination combobox", "target": "eXXX"}' })- Snapshot again — dialog opens with a search combobox.
- Type the destination (use
slowly: true):
mcp({ tool: "playwright_browser_type", args: '{"element": "destination search combobox", "target": "eXXX", "text": "Rome", "slowly": true}' })- Snapshot again — filtered results appear in the listbox.
- Click the correct option (e.g., "Rome, Italy"):
mcp({ tool: "playwright_browser_click", args: '{"element": "Rome, Italy destination option", "target": "eXXX"}' })Step 4: Set Departure Date
- Snapshot to find the departure textbox. Look for
textboxwith placeholder "Departure". - Click it to open the calendar dialog:
mcp({ tool: "playwright_browser_click", args: '{"element": "Departure date textbox", "target": "eXXX"}' })- Snapshot again — the calendar dialog shows multiple months as
rowgroupsections. - Find the target month section, then locate the specific date button. Date buttons are labeled with full names like
"Wednesday, July 15, 2026". - Click the date button:
mcp({ tool: "playwright_browser_click", args: '{"element": "Wednesday, July 15, 2026", "target": "eXXX"}' })Date label format: Convert YYYY-MM-DD to calendar button labels:
| Input | Button label |
2026-06-15 | "Monday, June 15, 2026" |
2026-01-01 | "Thursday, January 1, 2026" |
Month names: January, February, March, April, May, June, July, August, September, October, November, December.
Step 5: Set Return Date (Round-trip only)
If a return date was provided, the calendar is still open. Snapshot to find the return date button, then click it:
mcp({ tool: "playwright_browser_click", args: '{"element": "Monday, June 22, 2026", "target": "eXXX"}' })After selecting, click the "Done" button (look for button with text "Done") to close the calendar, or click outside the dialog.
Step 6: Set Passengers and Class (Optional)
- Snapshot to find the passenger button (shows "1 passenger") and class combobox (shows "Economy").
- Click, adjust, and close as needed using snapshot refs.
Step 7: Click Search
- Snapshot to find the search button (labeled "Search").
- Click it:
mcp({ tool: "playwright_browser_click", args: '{"element": "Search flights button", "target": "eXXX"}' })- Wait for results to load (3-8 seconds). You can use evaluate for a delay:
mcp({ tool: "playwright_browser_evaluate", args: '{"function": "() => new Promise(r => setTimeout(r, 5000))"}' })Step 8: Capture Results
- Snapshot the results page — this gives you the full accessibility tree of flight results:
mcp({ tool: "playwright_browser_snapshot", args: '{}' })- Optionally take a screenshot for visual debugging:
mcp({ tool: "playwright_browser_take_screenshot", args: '{"name": "flights-results", "fullPage": true, "savePng": true}' })- Parse the snapshot output — flight results appear as structured elements with times, airlines, durations, stops, and prices.
Step 9: Parse and Format Results
Parse the snapshot into a structured markdown table. Google Flights results typically include:
- Departure/arrival times
- Duration (including layovers)
- Airline name
- Price
- Number of stops
Format as:
| Departure | Arrival | Duration | Stops | Airline | Price |
|-----------|---------|----------|-------|---------|-------|
| 08:30 | 17:45 | 11h 15m | Nonstop | United | $452 |
| 14:20 | 23:55 | 11h 35m | 1 stop | Delta | $389 |Step 10: Close Browser
mcp({ tool: "playwright_browser_close", args: '{}' })Handling Edge Cases
Google Paywall / Captcha
If Google blocks automated access:
- Retry without headless mode (the browser defaults to visible)
- If a captcha appears, take a screenshot and ask the user to solve it
- Consider adding longer delays between interactions
Date Not Visible in Calendar
The calendar shows multiple months at once. If the target month isn't visible:
- Snapshot the calendar dialog
- Look for a "Next" button at the bottom of the calendar
- Click it to advance months, then snapshot again
Refs Not Found After Interaction
If you get "Ref eXXX not found" errors:
- You need a fresh snapshot — refs change after every navigation or DOM update
- Always snapshot before clicking/typing
Origin Already Set to Wrong City
If the default origin isn't what you need:
- Click the origin combobox (opens dialog)
- The search combobox in the dialog will show the current text
- Type your desired city (it replaces the existing text)
- Select the correct option from the filtered listbox
Multiple Result Pages
Google Flights shows ~10-15 flights per page. If more results are needed:
- Scroll down:
mcp({ tool: "playwright_browser_evaluate", args: '{"function": "() => window.scrollBy(0, document.body.scrollHeight)"}' }) - Wait briefly, then snapshot again for new results
Example Session
User: Find flights from Newark to Rome July 15-22, 2026
Agent workflow:
- Load this skill (
readthe SKILL.md) - Navigate to Google Flights + snapshot
- Click origin combobox → snapshot → type "Newark" → snapshot → click EWR option
- Click destination combobox → snapshot → type "Rome" → snapshot → click "Rome, Italy" option
- Click departure textbox → snapshot → find July in calendar → click "Wednesday, July 15, 2026"
- Click "Wednesday, July 22, 2026" for return
- Click "Done" button to close calendar
- Snapshot → click "Search" button
- Wait for results (evaluate delay)
- Snapshot results → parse into table → present to user
- Close browser
Key pattern: snapshot → find ref → act → snapshot → repeat.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

