Obtain Surescripts network credentials and a signed trading partner agreement; Surescripts Medication History is accessible only to credentialed participants (EHRs, PBMs, health systems)
Construct a medication history request using the NCPDP SCRIPT MedicationHistoryRequest message type, supplying patient demographics (name, date of birth, gender, zip code) and your organization's NPI and NCPDP sender ID
Transmit the request to the Surescripts endpoint over the required secure transport (typically HTTPS with mutual TLS using YOUR_CERT and YOUR_KEY) and include the required message header fields
Parse the MedicationHistoryResponse which returns a structured list of fill records, each containing drug name, NDC, fill date, quantity dispensed, days supply, prescriber NPI, and dispensing pharmacy NCPDP ID
Reconcile returned fill records against the patient's current medication list in your system, flagging discrepancies or unreported medications for clinical review
Audit log the request and response including patient identity, requesting user, and timestamp to satisfy Surescripts audit requirements and HIPAA access logging obligations
Known gotchas
Patient matching uses demographics only — Surescripts does not accept MRN or insurance ID for lookup; poor demographic data quality (misspelled names, wrong DOB) will result in no-match or wrong-patient responses
Medication history reflects pharmacy fill data only, not prescriptions that were written but never dispensed; clinicians must understand this distinction to avoid incorrect clinical conclusions
Surescripts enforces a permissible purpose requirement — medication history may only be requested in the context of a patient care event with documented patient consent; unauthorized queries can result in network suspension
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp