formula_add
Add or update a formula in a local library to extend your formula collection. Formulas are stored as YAML files organized by category.
Instructions
Add or update a formula in the local library.
This lets you (and the LLM) extend the local formula collection manually.
Formulas are persisted as YAML files under ``formulas/library/<category>/``.
Args:
id: Unique identifier for the formula (e.g., "custom_drag_force").
Used as the file name and lookup key.
name: Human-readable formula name.
sympy_str: SymPy-compatible expression, e.g. "F_d == 1/2 * rho * v**2 * C_d * A".
latex: LaTeX representation, e.g. "F_d = \frac{1}{2} \rho v^2 C_d A".
variables: Mapping of symbol names to metadata, e.g.
{"rho": {"description": "density", "unit": "kg/m^3"}}.
domain: Optional domain tag (e.g., "fluid_dynamics").
category: Optional category folder name (e.g., "fluid_dynamics").
description: Optional longer description of the formula.
aliases: Optional list of alternative names.
tags: Optional list of tags.
references: Optional list of references / URLs.
library_path: Optional custom library directory. Defaults to ``formulas/library``.
Returns:
{
"success": true,
"formula_id": "custom_drag_force",
"file_path": "formulas/library/fluid_dynamics/custom_drag_force.yaml",
"message": "Formula added to local library."
}
Example:
formula_add(
id="custom_drag_force",
name="Drag force",
sympy_str="F_d == 1/2 * rho * v**2 * C_d * A",
latex="F_d = \frac{1}{2} \rho v^2 C_d A",
domain="fluid_dynamics",
category="fluid_dynamics",
description="Drag force on a body in a fluid.",
variables={
"F_d": {"description": "drag force", "unit": "N"},
"rho": {"description": "density", "unit": "kg/m^3"},
"v": {"description": "velocity", "unit": "m/s"},
"C_d": {"description": "drag coefficient"},
"A": {"description": "reference area", "unit": "m^2"}
},
aliases=["drag force", "fluid drag"],
tags=["drag", "force"],
)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| name | Yes | ||
| tags | No | ||
| latex | Yes | ||
| domain | No | ||
| aliases | No | ||
| category | No | ||
| sympy_str | Yes | ||
| variables | Yes | ||
| references | No | ||
| description | No | ||
| library_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||