Skip to main content
Glama

ampl_get_data

Fetch AMPL entity values as records. Supports suffixes for primal values, duals, reduced costs, and bounds, with pagination and CSV export for parameters, variables, sets, constraints, and objectives.

Instructions

Read an entity's values as records.

suffix selects val, dual, rc, slack, lb or ub, so this one tool covers primal values, duals, reduced costs and bounds. At most one suffix may be requested per call: results.entity_rows tells an indexed (index, value) pair apart from a scalar value by checking for a 2-tuple, so passing multiple suffixes to get_values() on a scalar entity would be silently misread as an index/value pair.

Reading a PARAMETER can have a side effect: an indexed default that has never been referenced is computed and cached by AMPL only when read (documented AMPL laziness, not an amplpy quirk), and this tool forces that computation, but ONLY when a plain read comes back empty or short - never unconditionally - so a data-dependent default already read here keeps the value it had when read rather than tracking later changes to what it depends on; avoid reading such a parameter until you are done changing the data it depends on. If some instances of a PARAMETER (or VARIABLE) still have no value afterwards (a parameter with no default that was only partially assigned), that is reported via notes with ok: false, never silently reported as a complete, successful read. This completeness check does not apply to sets, constraints or objectives: num_instances() counts something other than "rows returned" for those (e.g. 1 for a whole set regardless of how many members it has), so comparing the two would misreport a perfectly normal empty set as a failed read.

name must be a bare AMPL entity name; it is interpolated into an AMPL statement, so anything else is an argument_error. limit is the page size and must be at least 1 - a limit of 0 or less is an argument_error, not an empty page reported as a successful read.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
limitNo
offsetNo
suffixNo
to_csvNo
sessionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Since no annotations are present, the description carries the full burden and excels: it discloses parameter-side-effect behaviors, AMPL lazy evaluation, completeness-check behavior (notes and ok: false), and validation errors for invalid names and limits. It even clarifies why sets/constraints/objectives are not subject to row-count checks, providing non-obvious behavioral details beyond any structured annotation.

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 description is long but every sentence earns its place. It is front-loaded with a one-sentence summary and then organized into focused paragraphs covering suffix rules, side effects, completeness checks, and validation requirements. No fluff or restatement of schema fields is present.

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

Completeness5/5

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

For a tool with six parameters, no annotations, and complex AMPL behavior, the description is remarkably complete. It covers side effects, error conditions, output hints (entity_rows, notes/ok), and limitations for non-row entities. The presence of an output schema further reduces the need to describe return values, so the overall context is sufficient.

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

Parameters4/5

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

The input schema has 0% property descriptions, so the description must compensate. It does so for the most critical parameters: name (bare entity name, interpolation risk), suffix (allowed values, at-most-one), and limit (page size, minimum 1). It omits explicit semantics for offset, to_csv, and session, which is a gap, but the coverage of error-prone parameters is substantial.

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?

The description opens with a specific verb and resource: 'Read an entity's values as records.' It further explains that suffix selects val/dual/rc/slack/lb/ub, which clearly distinguishes this tool from siblings like ampl_display or ampl_eval by scoping its purpose to structured reads of entity values.

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?

The description gives clear context on when to use the tool—for reading entity values with suffix options—and provides important avoid-conditions, such as not reading parameters whose data dependencies are still changing. It does not explicitly name alternative tools for similar reads, but the guidance is sufficient to choose this tool for record-oriented retrieval.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/worc4021/ampl-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server