Skip to main content
Glama
TheTsungYing

io.github.TheTsungYing/annealbridge

solve_optimization

Solve combinatorial optimization problems—selecting items within a budget, assigning shifts, or ordering visits—by returning ranked feasible solutions that meet hard and soft constraints.

Instructions

Solve a structured binary or bounded-integer combinatorial optimization problem.

Use this when the user asks which items to take within a budget, weight or
capacity, how to assign people or jobs to seats, shifts or machines, in
which order to visit a handful of places, or how to split things into
groups or pick a subset that meets several requirements at once — anything
expressible as yes/no or bounded-count decisions with a linear or quadratic
score and linear rules, even when the user never says "optimization".

Call this only after translating the user's request into explicit binary or
bounded-integer variables, an objective (linear/quadratic, minimize or
maximize), and hard or soft linear constraints. Do not pass natural-language
requirements.

An integer variable is declared with "type": "integer" plus integer
lower_bound and upper_bound (both required), and the problem must then carry
"version": "1.1" at its top level. A backend that compiles to bqm encodes
each integer in binary, so the compiled size grows with the range of the
bounds; a backend that compiles to cqm takes integers natively. Integer
values come back as ints inside their declared bounds.

Inequality constraints (<=, >=) require integer coefficients and right-hand
sides. Soft constraint weights are in objective units.

Leave solver.penalty_multiplier at its default unless a previous result was
infeasible on a remote backend; hard constraint penalties are managed by the
server. Call validate_optimization_problem first when planning to use a
remote backend or when the problem is large; on a local backend an invalid
document comes back as status invalid_problem with the same errors and
recommended_action, so solving directly spends nothing. Use
get_optimization_capabilities when you need the backend list or the full
schema. Use recommend_backend to compare backends; the choice remains yours.

Returns ranked feasible solutions with per-constraint evaluations, or a
structured error with a recommended_action. When the status is infeasible,
read infeasibility for the candidate that came closest to feasibility and
the share of candidates each hard constraint rejected, so the answer can
name the binding requirement instead of only reporting failure. Whatever
the status, the result's warnings are the same advisory warnings
validate_optimization_problem gives for this backend (an ignored seed or
parameter, a wide integer range, a negligible soft weight, ...) followed
by any raised during the run; read them before trusting a weaker answer
than expected. A field the schema does not declare is a tool error naming
its path, never ignored. If the user did not name a backend, say in the
answer which backend ran and why.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
problemYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorsNoStructured failures. Empty on success.
statusYesThe single verdict for the request. success: at least one feasible solution was found and ranked. infeasible: the pipeline ran but no candidate satisfied every hard constraint under re-validation — check infeasibility_proven before concluding none exists. invalid_problem: the problem failed validation and no backend was invoked. solver_error: the backend failed while executing, or a remote vendor reported an error. backend_unavailable: the requested backend is not registered, not installed, disabled by policy or missing credentials — there is never a silent fallback. resource_limit_exceeded: a request parameter or the compiled size exceeded a server-side ceiling; values are refused, never clamped. configuration_error: the server's own configuration is wrong, not the problem.
backendYesRegistry name of the backend that ran, or null when the request failed before a backend was chosen.
messageNoHuman-readable one-line summary of the result. On success: which backend produced it, whether optimality is proven, the rank-1 objective with its direction (and its soft violation when non-zero), how many distinct candidates the attempt saw, how many were feasible and how many are returned, and the attempt number when a retry produced it. On infeasible: why nothing feasible was found. On a failure: the first error's message. Deterministic — it never contains timings. Null when there is nothing to add.
attemptsYesOne entry per compile/solve/validate attempt, in order.
metadataNoSanitized execution facts about the last completed attempt, local backends included. Null when the request failed before any solve finished; the service never invents it.
warningsNoNon-blocking advice, same structure as an error: the warnings validate gives for this backend, then any raised during the run. Present whatever the status, except invalid_problem.
solutionsYesRanked feasible solutions, best first, at most solver.top_k. Empty unless status is success.
elapsed_msNoWall-clock milliseconds measured by the service from entering solve to returning, problem validation and any wait for a concurrency slot included. Unrelated to metadata.timing_us, which is what a vendor reports about its own side, and different on every run.
infeasibilityNoWhy the last attempt found nothing feasible. Present only when status is infeasible and that attempt had candidates to diagnose; null on every other status, and on an attempt that received no samples at all.
optimality_provenNoTrue only on success when an exhaustive backend enumerated every assignment: rank 1 is then the global optimum of ranking_score, not merely the best candidate seen. Always false on a heuristic or remote backend.
objective_directionYesEchoed from the problem, so a consumer can interpret objective_value without re-reading the input. Null when the request failed before the problem was read.
annealbridge_versionNoThe installed package version that produced this result; "unknown" outside an installed distribution.
infeasibility_provenNoTrue only when an exhaustive backend actually enumerated every assignment and found none feasible. On a heuristic or remote backend an infeasible result only means 'not found under this configuration'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden, and it delivers: it discloses return behavior (ranked feasible solutions, structured errors, infeasibility details), warning semantics, backend-specific integer encoding differences, and how undeclared fields become tool errors. It also explains penalty_multiplier behavior and when to leave it at the default, which is beyond what the schema alone communicates.

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—use cases, prerequisites, integer/version mechanics, constraint typing, validation guidance, sibling routing, and result interpretation are all packed in without fluff. It is front-loaded with purpose and examples before moving into technical and operational details, making it easy for an agent to scan.

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 complex tool with a single large structured parameter, an output schema, and three sibling tools, the description is remarkably complete. It covers when to call, what to translate first, how to handle validation, what results mean, how to read infeasibility information, what warnings imply, and how to report backend choice. Nothing essential for correct invocation is missing.

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?

Despite schema description coverage of 0%, the description compensates by explaining how to construct the problem parameter: explicit binary/bounded-integer variables, objective direction, linear/quadratic terms, and hard/soft constraints. It adds semantics not present in the schema, such as the version 1.1 requirement for integer variables, integrality rules for inequalities, soft-weight units, and integer encoding tradeoffs across backends. It does not enumerate every solver field, but it references get_optimization_capabilities for the full schema, so the gap is acceptable.

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 states a specific action—solving a structured binary or bounded-integer combinatorial optimization problem—and immediately grounds it in concrete user scenarios (budget, capacity, assignment, ordering, grouping). It also distinguishes itself from siblings by naming validate_optimization_problem, get_optimization_capabilities, and recommend_backend as separate tools, so an agent can tell them apart without opening schemas.

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

Usage Guidelines5/5

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

The description explicitly says when to use the tool ('Use this when the user asks which items to take...'), when not to use it ('Do not pass natural-language requirements'), and what must be done first ('Call this only after translating the user's request into explicit... variables'). It also names sibling tools with clear conditions, such as validating first for remote backends, using get_optimization_capabilities for the backend list, and using recommend_backend to compare backends.

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