Skip to main content
Glama

jean — Molecular Biology & Genomics

build_tree

Read-only

Build a phylogeny from aligned sequences — distance methods (NJ, BIONJ, FastME, UPGMA/WPGMA), parsimony, maximum likelihood, or Bayesian MCMC under a strict clock and coalescent prior — with branch support from a bootstrap, aLRT or aBayes, or, for the Bayesian method, clade posterior probabilities. Wire it downstream of align_sequences.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gammaNogamma shape for among-site rate variation in the DISTANCE correction; 0 disables. Not the ML +Γ, which is `ml_gamma_categories`. Advanced.
modelNodistance/substitution model (ape's names). K80 is the engine's default; very divergent sequences need raw or JC69.K80
_filesNoThe project: record references shaped like _subject. Their records become library documents a tool names in sequences/parts/document; a trace or alignment is found by file name.
methodNotree-building method; distance methods are fast, ML is the slowest and best-justified. Values: nj (Neighbor-Joining), bionj (BIONJ), fastme-bal (FastME (balanced)), fastme-ols (FastME (OLS)), upgma (UPGMA), wpgma (WPGMA), parsimony (Maximum Parsimony), ml (Maximum Likelihood), bayesian (Bayesian (MCMC)).nj
_subjectNoThe record to act on: exactly one of sequence, accession (+source), sample (an id from list_samples) or file ({name, text} or {name, base64}); record_index picks one record of several.
ml_modelNoML substitution model. Values: JC69 (JC69), F81 (F81), K80 (K80), HKY (HKY), TN93 (TN93), GTR (GTR). Only applies when method is ml, or when support_method is alrt or abayes or shalrt. Advanced.GTR
ml_shapeNoα of the discrete-Γ distribution over site rates — lower means more rate variation between sites. The starting value when the shape is estimated, and the fixed value when it is not. Inert while `ml_gamma_categories` is 1, because one category has no spread. Only applies when method is ml, or when support_method is alrt or abayes or shalrt. Advanced.
bootstrapNobootstrap replicates; 0 disables. Each replicate rebuilds the whole tree, so cost scales with it — 100 is the conventional minimum for a published tree and is the panel's default. Only applies when support_method is bootstrap.
ladderizeNoorder each node's children by clade size, so the drawing reads as a ladder. Changes the Newick's child order and nothing about the topology. Advanced.
sequencesNoaligned sequences — wire align_sequences' rows here, or name library documents.
fastme_nniNoFastME refinement by nearest-neighbour interchange (ape's `nni = TRUE`). Only applies when method is fastme-bal or fastme-ols. Advanced.
fastme_sprNoFastME balanced refinement by subtree prune-and-regraft (ape's `spr = TRUE`). Only applies when method is fastme-bal. Advanced.
ml_invariantNoproportion of sites that never change; 0 disables. The starting value when it is estimated. Only applies when method is ml, or when support_method is alrt or abayes or shalrt. Advanced.
bayesian_runsNoindependent runs (MrBayes nruns), seeded seed, seed+1, ...; 2 or more pools their samples and reports the average standard deviation of split frequencies and the PSRF. Only applies when method is bayesian.
bayesian_seedNoseed of the chain; the same seed and settings reproduce the same samples. Only applies when method is bayesian. Advanced.
bayesian_tempNoheating increment (MrBayes temp): chain j samples the posterior raised to 1/(1 + temp*j). Only applies when method is bayesian. Advanced.
midpoint_rootNoroot the result at its midpoint — a drawing convention, not evidence about where the true root is. Advanced.
sh_replicatesNoRELL replicates behind `shalrt` — resamples the three fits' per-site log-likelihoods, not the alignment, so a replicate costs microseconds rather than a whole re-inference. PhyML uses 10,000. Ignored unless `support_method` is `shalrt`. Only applies when support_method is shalrt. Advanced.
bayesian_clockNoclock model: strict (one rate on every branch), ucln, the uncorrelated lognormal relaxed clock (each branch its own rate, mean 1, log-scale sd sampled under Exponential(mean 1/3), as BEAST's UCRelaxedClockModel), or none: an unrooted tree with free branch lengths under an Exponential prior and no coalescent (MrBayes' unconstrained model). Only applies when method is bayesian.strict
bayesian_kappaNotransition/transversion ratio for K80/HKY, held fixed. Only applies when method is bayesian.
bayesian_modelNosubstitution model for the Bayesian chain, its parameters held fixed for the run: base frequencies are the alignment's own for F81/HKY, and kappa is `bayesian_kappa` for K80/HKY. Values: JC69 (JC69), F81 (F81), K80 (K80), HKY (HKY). Only applies when method is bayesian.JC69
bayesian_shapeNoGamma shape (alpha) for +G, held fixed for the run; smaller means more rate variation among sites. Only applies when method is bayesian.
bootstrap_seedNoseed for whichever resampling this run does — the bootstrap's replicates, or SH-aLRT's. The same seed always reproduces the same support values. Only applies when support_method is bootstrap or shalrt. Advanced.
support_methodNowhich branch support to attach. `bootstrap` resamples alignment columns and rebuilds the tree per replicate (uses `bootstrap`/`bootstrap_seed`). The three branch tests re-infer nothing: they score each internal branch against its two nearest-neighbour rearrangements under the ML model, three likelihood evaluations per branch instead of N whole re-inferences. `alrt` is the parametric test of Anisimova & Gascuel (2006), read against a mixture-of-chi-squares null, and it saturates at 99.985%. `abayes` is the Bayesian support of Anisimova et al. (2011). `shalrt` is the Shimodaira-Hasegawa-corrected variant (PhyML `-b -4`): the same three fits, but the gap is read against a null built by RELL-resampling their per-site log-likelihoods `sh_replicates` times from `bootstrap_seed` — slower than the other two, does not saturate, and usually more conservative. All three use `ml_model`/`ml_gamma_categories`/`ml_shape`/`ml_invariant` for the model, whichever `method` built the tree. Values: bootstrap (Bootstrap), alrt (aLRT), abayes (aBayes), shalrt (SH-aLRT).bootstrap
bayesian_chainsNoMetropolis-coupled chains per run (MrBayes nchains; its default is 4): the extra chains sample a flattened posterior and swap states with the cold one, so a run can cross valleys a single chain cannot. Each chain costs a full chain's time. Only applies when method is bayesian.
include_subjectNoalso include the node's subject.
bayesian_burn_inNoiterations discarded from the start. Only applies when method is bayesian.
ml_rearrangementNotopology search moves for the ML fit. `nni` moves one subtree past its neighbour and stops at the first topology no single move improves, which is a local optimum. `spr` runs that first and then sweeps prune-and-regraft, which reaches trees NNI cannot — at a quadratic number of rearrangements per sweep rather than a linear one. `tbr` runs both and then sweeps tree bisection and reconnection, which cuts a branch and rejoins the two halves by any pair of their branches: the largest neighbourhood here, measured at 1,950 distinct topologies against SPR's 814 on an 18-taxon tree, so roughly 2.4x an SPR sweep. Ignored unless `method` is `ml` and `ml_optimise_topology` is on. Values: nni (NNI), spr (NNI, then SPR), tbr (NNI, then SPR, then TBR). Only applies when method is ml. Advanced.nni
bayesian_clock_sdNowhere the relaxed clock's sigma (log-scale sd of branch rates) starts; always sampled. Only applies when bayesian_clock is ucln. Advanced.
bootstrap_measureNowhich bootstrap statistic to report. `fbp` is Felsenstein's proportion: the share of replicates that carry this exact branch: a yes/no question per replicate, so one taxon landing elsewhere makes the answer no, which is why a well-supported clade can read near zero on a large tree. `tbe` is the transfer bootstrap expectation (Lemoine et al. 2018, Nature 556:452-456): 1 minus the average number of taxa that would have to move to turn a replicate's nearest branch into this one, over the branch's depth. TBE reads higher than FBP on the same replicates and the two are NOT interchangeable, so say which one a number is. Both read the SAME replicates, so `tbe` costs no extra inference. Only applies when support_method is bootstrap.fbp
ml_optimise_ratesNofit the substitution rates rather than holding the model's own. Only applies when method is ml. Advanced.
ml_optimise_shapeNofit the discrete-Γ shape rather than holding `ml_shape`. Costs a degree of freedom in AIC/BIC, and does nothing while `ml_gamma_categories` is 1. Only applies when method is ml. Advanced.
pairwise_deletionNoexclude a gapped site only from the pairs it is missing in, rather than from every pair. ape's default is off (complete deletion), which keeps distances mutually comparable but discards a column if ANY sequence has a gap there — turn this on for gappy alignments.
bayesian_brlen_rateNowith no clock: rate of the Exponential prior on each branch length (MrBayes brlenspr=unconstrained:exp(rate)); 10 means a prior mean of 0.1 substitutions per site. Only applies when bayesian_clock is none. Advanced.
bayesian_iterationsNoMetropolis-Hastings proposals. Each rescores the alignment, so time grows with iterations x taxa x site patterns. Only applies when method is bayesian.
ml_gamma_categoriesNodiscrete-Γ rate categories for the rate heterogeneity across sites; 1 disables it. Only applies when method is ml, or when support_method is alrt or abayes or shalrt. Advanced.
bayesian_theta_shapeNoshape of the Gamma prior on theta. Only applies when method is bayesian. Advanced.
bayesian_theta_startNostarting theta of the chain (not a prior). Only applies when method is bayesian. Advanced.
ml_optimise_topologyNolet the ML search move the topology. With this off the result is the Neighbor-Joining topology with ML branch lengths, and the engine says so in a warning. Only applies when method is ml. Advanced.
bayesian_sample_kappaNosample kappa (K80/HKY) under MrBayes' Beta(1,1) prior on kappa/(1+kappa), starting from bayesian_kappa. Only applies when method is bayesian.
bayesian_sample_shapeNosample the Gamma shape under MrBayes' Exponential(1) prior instead of holding it at bayesian_shape (which becomes the start); needs bayesian_gamma_categories > 1. Only applies when method is bayesian.
ml_optimise_invariantNofit the proportion of invariant sites rather than holding `ml_invariant`. Costs a degree of freedom in AIC/BIC. Only applies when method is ml. Advanced.
bayesian_min_part_freqNoa clade enters the split-frequency deviation only if some run sampled it at least this share of the time (MrBayes minpartfreq). Only applies when method is bayesian. Advanced.
parsimony_rearrangementNoparsimony topology search: `nni` hill-climbs by nearest-neighbour interchange, `spr` adds prune-and-regraft when NNI stalls (phangorn's own default), `tbr` adds bisect-and-reconnect when SPR stalls. Nested, not alternatives: each runs the cheaper moves first, because every NNI move is an SPR move and every SPR move is a TBR move. `tbr` searches the largest neighbourhood this tool offers — 1,950 distinct topologies against SPR's 814 on an 18-taxon tree — and rescores each candidate whole, where SPR scores incrementally, so it is markedly the slowest. Values: nni (Nearest-neighbour interchange), spr (Subtree prune-and-regraft), tbr (Tree bisection and reconnection). Only applies when method is parsimony. Advanced.nni
bayesian_gamma_categoriesNodiscrete-Gamma categories for among-site rate variation (+G, each category its bin mean); 1 is equal rates. Only applies when method is bayesian.
bayesian_sample_frequencyNokeep one tree every this many iterations after burn-in. Only applies when method is bayesian. Advanced.
bayesian_theta_prior_meanNomean of the Gamma prior on theta = 4N mu, in substitutions per site. Only applies when method is bayesian. Advanced.
bayesian_sample_frequenciesNosample the base frequencies (F81/HKY) under a flat Dirichlet, starting from the alignment's own. Only applies when method is bayesian.
ml_optimise_base_frequenciesNofit base frequencies rather than holding them equal. Only applies when method is ml. Advanced.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
gammaYesthe Pybus-Harvey gamma statistic: negative if branching clusters toward the root (an early burst), positive if toward the tips. A standard normal deviate under the constant-rate null — read it with `gammaP`, and only if `clockDeviationInBranches` is below 1
gammaPYestwo-tailed P for `gamma` against the constant-rate (pure-birth) null
newickYesthe tree in Newick format
bayesianYesunder `method: bayesian`: the chain (iterations, burn-in, samples, seed, acceptance per operator), the fixed model, the priors, mean / 95% HPD / ESS of log L, theta and root height, every clade's posterior probability (0..1), the commonest topologies and the highest-posterior state. Absent under every other method
tipCountYesnumber of tips (leaves)
transferYesunder `support_method: bootstrap` with `bootstrap_measure: tbe`: per branch, its clade (the smaller side), its depth, the mean transfer distance over the replicates and the support on 0..1. Absent under `fbp`, which puts its values on the tree and nowhere else
warningsYeswhat the method had to say about the data
statisticsYestree statistics: tips, height, total length, diameter, the branch-length distribution, Colless/Sackin imbalance, cherries, treeness, the Pybus-Harvey gamma with its two-tailed P, and the ultrametricity readouts gamma depends on (`isUltrametric`, `rootToTipSpread`, `clockDeviationInBranches`)
distanceMapYesthat distance matrix as a heatmap
branchSupportYesunder `alrt`/`abayes`: the measure, the model, the tree's log-likelihood, and per branch its clade, the two alternative log-likelihoods, the statistic and the support (a fraction, not a percentage). Absent under `bootstrap`
distanceMatrixYesthe pairwise distance matrix the tree was built from
clockDeviationInBranchesYeshow far from clock-like the tree is, in MEAN BRANCH LENGTHS. `gamma` and any lineages-through-time reading assume an ultrametric tree; below 1 the raggedness cannot reorder a branching event, above it the statistic is partly rate variation and is not a diversification result

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false and closed-world, so the safety profile is covered. The description adds genuinely new behavioral context: the methodological scope (distance through Bayesian MCMC under a strict clock and coalescent prior) and what the output carries (bootstrap/aLRT/aBayes support or clade posterior probabilities), though it omits any warning about the very different runtimes of ML/Bayesian versus distance methods.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core purpose and tightly packed for a 49-parameter tool; the closing pipeline directive is short and actionable. The method/support enumeration mildly duplicates the schema enums, which is the only thing keeping it from a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given an output schema exists and the schema carries full parameter documentation, the description need not restate returns or parameter mechanics. It supplies the algorithmic scope and pipeline placement an agent needs to select the tool, leaving only runtime/cost trade-offs unstated.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 49 parameters and 100% schema description coverage, every parameter is already fully documented in the schema, so the baseline of 3 applies. The description's mention of method families and support types maps onto schema enums rather than adding new syntax or constraint detail beyond them.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (build) and resource (phylogeny) and enumerates the algorithm families it can run (distance, parsimony, ML, Bayesian), which is far more than restating the name. An agent can immediately distinguish it from siblings like draw_tree, export_tree, transform_tree, or tree_statistics, which operate on an existing tree rather than inferring one.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Wire it downstream of align_sequences' gives a concrete pipeline precondition and points at the correct upstream sibling. It does not, however, name any explicit exclusions or alternatives (e.g. when to prefer draw_tree/compare_trees instead), so it stops short of full when/when-not routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources