brapi_build_phenotype_matrix
Build a germplasm × trait matrix from one or more studies and materialize it as a canvas dataframe. Supports wide (pivot) or long shape with configurable per-cell aggregation.
How to use it
brapi_build_phenotype_matrix is exposed by the Brapi MCP Server MCP server. Add the server to your MCP client (Claude Desktop, Cursor, Windsurf and others), and the brapi_build_phenotype_matrix tool becomes available to the model automatically. See the full listing for setup details and every tool this server provides.
Install Brapi MCP Server
docker run --rm -p 3010:3010 brapi-mcp-serverOther tools in Brapi MCP Server (24)
Authenticate, register the connection under an alias, cache the capability profile, and return the orientation envelope inline. One call fully orients the agent.
Start here after a spillover. Lists dataframes (or describes one) with column schema, row counts, and originating-source provenance.
Opt-in via BRAPICANVASDROPENABLED=true. Drop a dataframe by name. Idempotent. Dataframes also expire via TTL when left unmanaged.
Opt-in via BRAPIEXPORTDIR=<path>, stdio-only. Export a dataframe to disk (CSV / Parquet / JSON) under the configured directory and return the absolute path for the human to open. Optional columns projection or sql filter materializes a derived table for the export, dropped after.
SELECT SQL across in-memory dataframes (DuckDB-backed). Spilled find rows auto-register as df<uuid>. Read-only — multi-statement, non-SELECT, file-reads, and exports rejected. Returns typed columns ({ name, type }[]).
Static BrAPI v2.1 filter catalog for any endpoint — powers extraFilters discovery on every find tool.
Export genotype calls for a variant set as a germplasm × variant canvas dataframe; also serializes to VCF-lite or PLINK .ped/.map text. Distinct-variant columns bounded by BRAPIGENOTYPEMATRIXMAXCOLUMNS (default 10k, max 500k).
Pull genotype calls via async-search polling. Upstream pull bounded by BRAPIGENOTYPECALLSMAXPULL (default 100k, max 500k).
Find germplasm by name, synonym, accession, PUI, crop, or free-text. Distributions + dataframe spillover.
Filter image metadata by unit / study / ontology / MIME type. Bytes via brapigetimage.
Find research stations by country (ISO alpha-3 code, or English country name resolved client-side) / type / abbreviation, with optional client-side bbox filter.
Pull observation records by study / germplasm / variable / season / unit / timestamp. Dataframe spillover.
Find studies by crop / trial type / season / location / program. Distributions + dataframe spillover.
Find observation variables by name / class / ontology / free-text; ranked client-side via OntologyResolver when text is supplied.
Find variant records by variant set, reference, or genomic region (1-based inclusive / exclusive).
Per-variable performance aggregates (n, mean, median, sd, min, max, studyCount) for a single germplasm across all studies where it has observations.
Fetch a germplasm with attributes, direct parents, and companion counts (studies, parents, descendants).
Fetch image bytes for up to 5 imageDbIds inline as type: image blocks. Prefers /imagecontent, falls back to imageURL.
Fetch a study with program / trial / location FKs resolved and companion counts (observations, units, variables).
Passthrough to any BrAPI GET /{path} not covered by curated tools. Emits a routing nudge when one applies.
Passthrough to any POST /search/{noun} with async polling handled transparently. Same nudge pattern.
Re-fetch the orientation envelope for a registered alias — identity, auth, capabilities, content counts, attribution, notes.
Two-phase observation write — mode: preview validates; mode: apply elicits confirmation, then fans POST + PUT in parallel. Additive only — no destructive deletion.
BFS-walk ancestry / descendancy as a deduplicated DAG with cycle detection, depth limits, and traversal stats.