Build a Clinical Trial AI Agent With MCP and Valyu
Ask a general chatbot "which Phase 3 anti-amyloid trials are still running, and what does the FDA label say about ARIA?" and you usually get a confident paragraph with a stale enrollment number and no NCT IDs. Clinical t
Ask a general chatbot "which Phase 3 anti-amyloid trials are still running, and what does the FDA label say about ARIA?" and you usually get a confident paragraph with a stale enrollment number and no NCT IDs. Clinical trial questions need four kinds of evidence at once: the trial registry, the published papers, the FDA label and post-market adverse event reports. An agent that can't reach all four will guess.
This guide builds that agent two ways, using Alzheimer's disease as the worked example (lecanemab / Leqembi, donanemab / Kisunla and Roche's trontinemab):
- Path 1, zero code: connect the Valyu MCP server to Claude, ChatGPT or Cursor and prompt it.
- Path 2, the SDK: a short script (Python and TypeScript versions) that runs the same multi-source workflow across ClinicalTrials.gov, PubMed, DailyMed drug labels and openFDA FAERS.
Every NCT ID, status, sponsor, enrollment count and endpoint below was checked against ClinicalTrials.gov on November 24, 2026. For the wider architecture, operational vs research agent comparison and curated workflows, see the companion pillar guide on clinical trial AI agents.
The problem with the raw registry API
ClinicalTrials.gov has a good, free v2 API. Here is the obvious first attempt: active Phase 3 interventional Alzheimer's trials.
import json, urllib.request, urllib.parse
params = {
"query.cond": "Alzheimer Disease",
"filter.overallStatus": "RECRUITING|ACTIVE_NOT_RECRUITING",
"query.term": "AREA[Phase]PHASE3 AND AREA[StudyType]INTERVENTIONAL",
"pageSize": "50",
}
url = "https://clinicaltrials.gov/api/v2/studies?" + urllib.parse.urlencode(params)
data = json.load(urllib.request.urlopen(urllib.request.Request(url, headers={"User-Agent": "demo"})))
for s in data["studies"]:
p = s["protocolSection"]
print(p["identificationModule"]["nctId"],
p["statusModule"]["overallStatus"],
p["sponsorCollaboratorsModule"]["leadSponsor"]["name"],
p["designModule"]["enrollmentInfo"]["count"])
It returned 50 studies in 0.82 seconds. Fast, but look at what came back:
NCT07284472 | RECRUITING | Exciva GmbH | 300 | EXV-802, Placebo, EXV-801
NCT06653153 | ACTIVE_NOT_RECRUITING | Eli Lilly and Company | 1400 | Remternetug, Placebo
NCT06120049 | RECRUITING | prof. dr. Koen Van Laere | 113 | [18F]-MFBG PET CT, ...
NCT07170150 | ACTIVE_NOT_RECRUITING | Hoffmann-La Roche | 1060 | Trontinemab, Placebo
NCT07011732 | RECRUITING | Bristol-Myers Squibb | 426 | Xanomeline/Trospium ...
NCT04437511 | ACTIVE_NOT_RECRUITING | Eli Lilly and Company | 1736 | Donanemab, Placebo
NCT07177352 | RECRUITING | Hoffmann-La Roche | 80000 | No Intervention
...
Three problems show up straight away:
- Keyword matching, not meaning. The list mixes antibody trials with PET tracer studies, psychosis drugs, a cardiomyopathy trial and an 80,000-person screening study with no study drug. Your code has to sort it out.
-
Deeply nested JSON. Each field lives several levels down (
protocolSection.designModule.enrollmentInfo.count), and a single record can run past 25,000 characters. - No surrounding evidence. The registry says nothing about the published results, the FDA boxed warning or what is turning up in adverse event reports. That is three more APIs, three more schemas and three more parsers.
One search across four sources
The Valyu Search API takes a plain-language query and an included_sources list. Here is one call across the trial registry, PubMed, DailyMed drug labels and openFDA FAERS:
from valyu import Valyu
valyu = Valyu() # reads VALYU_API_KEY
res = valyu.search(
"lecanemab donanemab Alzheimer's disease phase 3 efficacy and ARIA safety",
included_sources=[
"valyu/valyu-clinical-trials",
"valyu/valyu-pubmed",
"valyu/valyu-drug-labels",
"valyu/valyu-openfda-drug-events",
],
max_num_results=12,
)
for r in res.results:
print(f"[{r.source}] {r.title[:80]} | {r.url}")
Output (3.74 seconds):
[valyu/valyu-clinical-trials] Assessment of Safety, Tolerability, and Efficacy of Donanemab in Early Symptomatic Alzheim | https://clinicaltrials.gov/study/NCT04437511
[valyu/valyu-clinical-trials] AHEAD 3-45 Study: A Placebo-Controlled, Double-Blind, Parallel-Treatment Arm, 216 Week Stu | https://clinicaltrials.gov/study/NCT04468659
[valyu/valyu-clinical-trials] Investigating the Effect of Different Donanemab Dosing Regimens on ARIA-E and Amyloid Lowe | https://clinicaltrials.gov/study/NCT05738486
[valyu/valyu-clinical-trials] Global Study to Investigate Safety and Efficacy of Donanemab in Early Symptomatic Alzheime | https://clinicaltrials.gov/study/NCT05508789
[valyu/valyu-pubmed] Amyloid-Related Imaging Abnormalities With Anti-amyloid Antibodies for the Treatment of De | https://pubmed.ncbi.nlm.nih.gov/PMC8985815
[valyu/valyu-clinical-trials] A Placebo-Controlled, Double-Blind, Parallel-Group, 18-Month Study With an Open-Label Exte | https://clinicaltrials.gov/study/NCT03887455
[valyu/valyu-pubmed] Anti-Amyloid Monoclonal Antibodies in Early Alzheimer Disease: Lecanemab and Donanemab | https://pubmed.ncbi.nlm.nih.gov/PMC13610423
...
Every hit is on topic: TRAILBLAZER-ALZ 2, AHEAD 3-45, TRAILBLAZER-ALZ 6 (a trial designed around ARIA-E), Clarity AD, and review papers on ARIA. The content comes back as readable text an LLM can reason over, not nested JSON.
Two honest notes from testing. A broad query like this one is dominated by trials and papers; labels and FAERS reports surface more reliably when you query each source directly with a drug name, which is what the agent below does. And results are ranked by relevance, so treat them as prioritized hits rather than an exhaustive registry dump.
Path 1: zero-code MCP
The Valyu MCP server lives at one address:
https://mcp.valyu.ai/mcp
Paste it into your client and sign in with your Valyu account, so no key is pasted anywhere.
Claude: go to Customize β Connectors, click Add custom connector, paste https://mcp.valyu.ai/mcp, click Add, then Connect and sign in. This works on every Claude plan, including Free.
ChatGPT: go to Plugins, click +, then Add custom MCP server. Paste https://mcp.valyu.ai/mcp under Connection, keep OAuth, then click Create as a plugin and sign in.
Claude Code:
claude mcp add --transport http valyu "https://mcp.valyu.ai/mcp?valyuApiKey=YOUR_API_KEY"
Cursor, Codex and other MCP clients:
{
"mcpServers": {
"valyu": {
"type": "http",
"url": "https://mcp.valyu.ai/mcp?valyuApiKey=YOUR_API_KEY"
}
}
}
If your client can set headers, Authorization: Bearer YOUR_API_KEY keeps the key out of logged URLs. The full walkthrough with screenshots is in the chat apps guide, and the MCP server reference lists every tool. The ones that matter most here are valyu_search (query clinical trials, PubMed, FDA labels and FAERS) and valyu_deepresearch (a longer cited synthesis).
Prompts that work
The model picks the sources, so the prompt's job is to say which evidence you want and how to structure it. These name the sources, ask for NCT IDs and keep each evidence type clearly separated:
Landscape scan
Use Valyu to search ClinicalTrials.gov for Phase 3 interventional trials of
anti-amyloid or anti-tau antibodies in Alzheimer's disease that are recruiting
or active, not recruiting. Return a table: NCT ID, drug, sponsor, status,
enrollment (actual or estimated), primary endpoint, and source URL for each row.
Evidence check on one drug
For donanemab (Kisunla): 1) find its Phase 3 trials, 2) find published PubMed
papers reporting efficacy and ARIA rates, 3) quote the boxed warning from the
DailyMed label, 4) summarize what FAERS reports show. Cite a URL for every claim
and keep registry facts, published results and spontaneous reports separate.
Head-to-head safety
Compare the FDA label boxed warnings for Leqembi and Kisunla word for word,
including the ApoE e4 homozygote guidance. Then list the ARIA-related FAERS
report types you find for each drug.
Three tips from running these:
- Ask for NCT IDs and source URLs. Requiring an NCT ID and direct URL on every row makes it trivial to inspect any trial in seconds.
- Keep evidence types apart. A FAERS report is a spontaneous report, not proof the drug caused the event. Asking the model to separate registry facts, trial results and reports keeps answers honest.
-
Use DeepResearch for the big questions. "Write a landscape report on every Phase 3 anti-amyloid program" is many searches;
valyu_deepresearchruns them and returns one cited report.
Path 2: the SDK agent
When you want the workflow in a pipeline, a dashboard or your own agent loop, call the API directly. Install the SDK and set your key:
pip install valyu # Python
npm install valyu-js # TypeScript / Node
export VALYU_API_KEY=your_key
The agent runs three focused steps across four datasets:
- Find Phase 3 Alzheimer's antibody trials on ClinicalTrials.gov.
- Pull published efficacy and safety papers from PubMed.
- Check the FDA drug label warnings on DailyMed and spontaneous FAERS adverse event reports.
Python
from valyu import Valyu
valyu = Valyu() # reads VALYU_API_KEY
def search(query, source, n=6):
res = valyu.search(query, included_sources=[source], max_num_results=n)
return res.results or []
# 1. Find Phase 3 Alzheimer's antibody trials
trials = search(
"phase 3 Alzheimer's disease donanemab lecanemab trontinemab trial",
"valyu/valyu-clinical-trials",
)
# 2. Published efficacy and safety evidence
papers = search("lecanemab donanemab phase 3 efficacy ARIA safety", "valyu/valyu-pubmed")
# 3. FDA label warnings and FAERS reports (short drug-name queries work best)
labels = search("Leqembi lecanemab boxed warning ARIA", "valyu/valyu-drug-labels", 3)
faers = search("KISUNLA donanemab adverse event reports", "valyu/valyu-openfda-drug-events", 5)
for t in trials[:4]:
print("TRIAL", t.title[:80], "|", t.url)
for p in papers[:3]:
print("PAPER", p.title[:80], "|", p.url)
for l in labels[:1]:
print("LABEL", l.title[:80], "|", l.url)
for f in faers[:3]:
print("FAERS", f.title.replace("\u2014", "-")[:90])
Sample output:
TRIAL Assessment of Safety, Tolerability, and Efficacy of Donanemab in Early Symptomat | https://clinicaltrials.gov/study/NCT04437511
TRIAL Global Study to Investigate Safety and Efficacy of Donanemab in Early Symptomatic | https://clinicaltrials.gov/study/NCT05508789
TRIAL A Study to Evaluate the Efficacy and Safety of Trontinemab in Participants With Ea | https://clinicaltrials.gov/study/NCT07170150
TRIAL A Study to Evaluate the Efficacy and Safety of Trontinemab in Participants With Pr | https://clinicaltrials.gov/study/NCT07717411
PAPER Further data to address the Alzheimer's coverage with evidence development quest | https://pubmed.ncbi.nlm.nih.gov/PMC13438179
PAPER Amyloid-Related Imaging Abnormalities With Anti-amyloid Antibodies for the Treat | https://pubmed.ncbi.nlm.nih.gov/PMC8985815
PAPER Comparison of safety of lecanemab and donanemab: a real-world disproportionality | https://pubmed.ncbi.nlm.nih.gov/PMC13333721
LABEL LEQEMBI (LECANEMAB) INJECTION, SOLUTION LECANEMAB AUTOINJECTOR (LECANEMAB-IRMB) | https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=9d1ff786-e577-410a-a273-c4d7d0e4e975
FAERS FAERS report on KISUNLA - Amyloid related imaging abnormality-microhaemorrhages and haemos
FAERS FAERS report on KISUNLA - Amyloid related imaging abnormality-oedema/effusion
FAERS FAERS report on KISUNLA - Cerebrovascular accident
TypeScript
import { Valyu } from "valyu-js";
const valyu = new Valyu(); // reads VALYU_API_KEY
async function search(query: string, source: string, n = 6) {
const res = await valyu.search(query, { includedSources: [source], maxNumResults: n });
return res.results ?? [];
}
const [trials, papers, labels, faers] = await Promise.all([
search("phase 3 Alzheimer's disease donanemab lecanemab trontinemab trial", "valyu/valyu-clinical-trials"),
search("lecanemab donanemab phase 3 efficacy ARIA safety", "valyu/valyu-pubmed"),
search("Kisunla donanemab boxed warning ARIA", "valyu/valyu-drug-labels", 3),
search("KISUNLA donanemab adverse event reports", "valyu/valyu-openfda-drug-events", 5),
]);
trials.slice(0, 4).forEach((t) => console.log("TRIAL", t.title.slice(0, 80), "|", t.url));
papers.slice(0, 3).forEach((p) => console.log("PAPER", p.title.slice(0, 80), "|", p.url));
labels.slice(0, 1).forEach((l) => console.log("LABEL", l.title.slice(0, 80), "|", l.url));
faers.slice(0, 3).forEach((f) => console.log("FAERS", f.title.replace("\u2014", "-").slice(0, 90)));
The TypeScript run returned the same four trials, the same papers and FAERS reports, and the Kisunla DailyMed label (https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=190352d4-ef62-4679-b4fa-e846e2766afa), running all four dataset queries concurrently via Promise.all.
What the agent found
These are the Phase 3 programs the searches surfaced across ClinicalTrials.gov (checked on November 24, 2026):
| NCT ID | Trial | Drug | Sponsor | Status | Enrollment | Primary endpoint |
|---|---|---|---|---|---|---|
| NCT03887455 | Clarity AD | Lecanemab | Eisai Inc. | Active, not recruiting | 1,906 (actual) | CDR-SB change at 18 months |
| NCT04468659 | AHEAD 3-45 | Lecanemab | Eisai Inc. | Active, not recruiting | 1,400 (estimated) | Preclinical Alzheimer Cognitive Composite 5 change (A45) |
| NCT04437511 | TRAILBLAZER-ALZ 2 | Donanemab | Eli Lilly and Company | Active, not recruiting | 1,736 (actual) | iADRS change from baseline |
| NCT05026866 | TRAILBLAZER-ALZ 3 | Donanemab | Eli Lilly and Company | Active, not recruiting | 2,996 (estimated) | Time to clinical progression on CDR |
| NCT05508789 | TRAILBLAZER-ALZ 5 | Donanemab | Eli Lilly and Company | Active, not recruiting | 1,500 (estimated) | iADRS change from baseline |
| NCT05738486 | TRAILBLAZER-ALZ 6 | Donanemab | Eli Lilly and Company | Active, not recruiting | 1,175 (actual) | Percentage with any ARIA-E |
| NCT07170150 | TRONTIER 2 | Trontinemab | Hoffmann-La Roche | Active, not recruiting | 1,060 (actual) | CDR-SB change at week 72 |
| NCT07717411 | PrevenTRON | Trontinemab | Hoffmann-La Roche | Recruiting | 1,600 (estimated) | Time to confirmed CDR-GS > 0 |
A few things the table makes obvious that a chatbot answer would blur. Clarity AD's primary completion date is listed as 31 December 2026 (estimated) because the open-label extension is still running, even though the core 18-month result was reported years ago. TRAILBLAZER-ALZ 6 exists specifically to test dosing regimens that lower ARIA-E. And Roche's PrevenTRON prevention trial in cognitively unimpaired people started on 2 October 2026, so it is the newest entry here.
On the safety side, both DailyMed labels carry the same class boxed warning, "WARNING: AMYLOID RELATED IMAGING ABNORMALITIES", which states that ARIA "is usually asymptomatic, although serious and life-threatening events can occur. ARIA can be fatal." It adds that ApoE Ξ΅4 homozygotes "have a higher incidence of ARIA", so ApoE Ξ΅4 testing "should be performed prior to initiation of treatment." The Kisunla label lists a boxed warning revision dated 07/2025.
The FAERS search for Kisunla returned serious reports coded as ARIA-microhaemorrhages and haemosiderin deposition, ARIA-oedema/effusion, cerebrovascular accident and infusion related reaction, all received between August and September 2024. These are individual spontaneous reports. They tell you what is being reported, not how often it happens or whether the drug caused it.
Query tips that made a difference
-
Query one source at a time for labels and FAERS. Mixed-source queries favor trials and papers.
"KISUNLA donanemab adverse event reports"againstvalyu/valyu-openfda-drug-eventsreturned five on-target reports; a long query mixing ARIA, cerebral edema and hemorrhage terms returned none. -
Use brand and generic names together. FAERS reports are often filed under the brand name (
KISUNLA,LEQEMBI). Including both catches more. -
Watch for co-medication matches. Searching
"lecanemab"in FAERS returned reports filed primarily under Eliquis or Plavix where lecanemab was a co-medication. Check the primary suspect drug before counting a report. -
Expect phase noise. Even a
"phase 3"query can return Phase 2/3 adaptive trials (for example, remternetug'sNCT05552157). Filter on thephasesfield when you need strict Phase 3 lists.
Getting started
New accounts get free credits every month, up to 2,000 with a work email. Create an account to get an API key, or connect https://mcp.valyu.ai/mcp to your assistant and start with the prompts above.
Where to go next
- Swap the theme: replace the queries with your own indication and drug names. The three-step shape stays the same.
- Add a model: feed
res.resultsinto your LLM of choice and ask it to write the table while preserving every NCT ID and source URL. - Read the broader guide to clinical trial AI agents for more use cases, and the MCP server docs for the full tool list.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.