Workflow: Get PDF

This guide outlines the execution steps and logic for the "Get PDF" service. The AI agent must follow these instructions strictly to fulfill the user's request.

Required parameters

  • page_title (string): The requested MediaWiki page name, extracted from the user's email.

Available tools

  • validate_or_find_closest_page(page_title): Checks the wiki to see if the page exists. Returns a JSON object with the status (exact_match, closest_match, or not_found) and the resolved page title.
  • generate_and_send_pdf(resolved_title): Generates a PDF of the specified wiki page and attaches it to an email reply in the current thread.

Execution steps

  1. Validate the page: Execute the validate_or_find_closest_page tool using the extracted page_title.
  2. Evaluate the validation status and act:
    • If exact_match: Execute generate_and_send_pdf using the resolved title. Draft a polite, concise email confirming the requested PDF is attached.
    • If closest_match: Execute generate_and_send_pdf using the new resolved title. Draft an email explaining that you couldn't find the exact page they asked for, but you have attached the closest match. Politely ask them to check the spelling if this is not the document they needed.
    • If not_found: Do NOT attempt to generate a PDF. Draft a polite email stating that the page and any close variations could not be found, and ask the user to double-check their spelling.