55 lines
2.2 KiB
Python
55 lines
2.2 KiB
Python
"""Prompts for the shared MCP server."""
|
|
|
|
from mcp_servers.shared.server import mcp
|
|
|
|
DELAY_TEMPLATES = {
|
|
("WEATHER", "passenger"): (
|
|
"Explain this flight delay to a passenger. The cause is weather-related. "
|
|
"Be empathetic and transparent. Include what's happening with the weather, "
|
|
"what the airline is doing about it, and what the passenger should expect next. "
|
|
"Do not use aviation jargon."
|
|
),
|
|
("WEATHER", "ops_manager"): (
|
|
"Summarize this weather-caused delay for an ops manager. "
|
|
"Include: delay cause code, affected systems, GDP/ground stop status if applicable, "
|
|
"forecast window, and recommended next actions. Be concise."
|
|
),
|
|
("MAINTENANCE", "passenger"): (
|
|
"Explain this maintenance-caused delay to a passenger. "
|
|
"Be reassuring — emphasize safety. Describe what's being checked "
|
|
"without technical jargon. Give expected timeline if available."
|
|
),
|
|
("MAINTENANCE", "ops_manager"): (
|
|
"Summarize this maintenance delay for an ops manager. "
|
|
"Include: MEL item, system affected, restriction details, "
|
|
"estimated release time, and downstream impact."
|
|
),
|
|
("CREW", "passenger"): (
|
|
"Explain this crew-related delay to a passenger. "
|
|
"Frame it as 'ensuring your crew is fully rested for safe operation.' "
|
|
"Do not mention specific regulations or duty limits."
|
|
),
|
|
("CREW", "ops_manager"): (
|
|
"Summarize this crew-caused delay for an ops manager. "
|
|
"Include: Part 117 status, hours remaining, swap options, "
|
|
"backup crew availability, and timeline."
|
|
),
|
|
}
|
|
|
|
|
|
@mcp.prompt()
|
|
def delay_explainer(cause_code: str, audience: str) -> str:
|
|
"""Turns a raw delay cause code into a human-readable explanation prompt.
|
|
|
|
cause_code: WEATHER | MAINTENANCE | CREW | ATC | LATE_AIRCRAFT
|
|
audience: passenger | ops_manager
|
|
"""
|
|
key = (cause_code.upper(), audience.lower())
|
|
default_key = ("WEATHER", audience.lower())
|
|
template = DELAY_TEMPLATES.get(key, DELAY_TEMPLATES.get(default_key, ""))
|
|
return (
|
|
f"{template}\n\n"
|
|
"Use the operational data provided below. Do not invent details. "
|
|
"If data is missing for a section, omit that section."
|
|
)
|