Skip to main content
Glama
mathmethods-mcp

mathmethods-mcp

interpolation_lagrange

Build the Lagrange interpolating polynomial from points or a generating function, evaluate it at a specific x, and optionally plot the result.

Instructions

Build the Lagrange interpolating polynomial through a set of points.

Provide either the point values puntos_y or the generating function func_str evaluated at puntos_x.

Args: puntos_x: Distinct abscissas of the interpolation points. x_eval: Optional x where the polynomial is evaluated. func_str: Optional generating function f(x) for the y values. puntos_y: Optional y values matching puntos_x one-to-one. precision: Rounding digits. plot: When True, also return a PNG plot of the polynomial and points.

Returns: Dict with the polynomial, its degree, the points table and error bounds when func_str is provided. With plot=True a list [dict, Image] is returned instead.

Input Schema

NameRequiredDescriptionDefault
plotNo
x_evalNo
func_strNo
puntos_xYes
puntos_yNo
precisionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.1
    • addedInput schema / properties / plot
      Added value: +{
      +  "default": false,
      +  "title": "Plot",
      +  "type": "boolean"
      +}
  2. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full behavioral burden. It discloses key traits: the either/or input requirement, that ``puntos_x`` must be distinct, that precision controls rounding, that ``plot=True`` adds a PNG to the result, and that error bounds are returned when ``func_str`` is supplied. It still omits error handling when both y-value sources are provided, neither is provided, or ``func_str`` is invalid.

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

Conciseness5/5

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

The purpose is front-loaded in one sentence, followed by focused Args and Returns sections. The structure is efficient and every listed item carries useful information for an agent.

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?

With no annotations and no output schema, the description must document both behavior and return shape, which it largely does by explaining the returned dict contents and the list-with-Image variant when plotting. Minor omissions remain around precedence when both ``puntos_y`` and ``func_str`` are supplied and around error conditions.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate, and it does: every parameter is explained with meaning beyond its type. It clarifies that ``puntos_x`` are distinct abscissas, ``x_eval`` is an optional evaluation point, ``func_str`` is a generating function f(x), ``puntos_y`` must match ``puntos_x`` one-to-one, ``precision`` is rounding digits, and ``plot`` produces a PNG.

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 and resource: 'Build the Lagrange interpolating polynomial through a set of points.' The method is unambiguous and clearly distinct from the root-finding, integration, ODE, and dynamic-system siblings.

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

Usage Guidelines3/5

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

The description specifies an input mode ('Provide either the point values ``puntos_y`` or the generating function ``func_str`` evaluated at ``puntos_x``'), which is useful guidance. However, it does not state when this interpolation tool should be chosen over alternatives, nor any conditions under which it should not be used.

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