# Tolerance Stack-up Analyzer (Worst Case, RSS, Monte Carlo) (`jumblemog/tolerance-stackup-analyzer`) Actor

Tolerance stack-up analysis from plain text: worst case, RSS, Monte Carlo, yield, ppm and Cpk, contributors, plus ISO 286 hole and shaft fits (H7/g6). For engineers and AI agents.

- **URL**: https://apify.com/jumblemog/tolerance-stackup-analyzer.md
- **Developed by:** [Jumble Mog](https://apify.com/jumblemog) (community)
- **Categories:** AI, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Tolerance Stack-up Analyzer (Worst Case, RSS, Monte Carlo)

**Will the parts fit? Write the stack-up as text and find out.** Type a chain of dimensions such as `+ housing depth 50 ±0.1; - bearing width 20 ±0.05; - spacer 19.8 +0.05/-0; gap 0.05 to 0.5`. You get back:

- **Every standard method side by side**:
  - Worst case (arithmetic).
  - RSS: the root sum square, reported as mean ± 3σ.
  - Modified RSS.
  - A Monte Carlo simulation of 200,000 assemblies, with a fixed seed so runs repeat.
- **The verdict against your requirement**: whether the worst case fits, the share and ppm out of spec (from the normal theory and from the simulation), Cp and Cpk.
- **What drives it**: each dimension's share of the variation and of the worst case.
- **What to change**: the factor every tolerance could be scaled by to meet the worst case, or to reach a target Cpk (1.33 unless you say otherwise), and how far to move the mean to center it.
- **A chart**: the simulated gap histogram with the requirement, worst-case and RSS ranges, next to the contributions.

Each dimension can be:

- **Normal**: the tolerance band is ±3σ, or set a `Cpk` or `sigma`.
- **Uniform** or **triangular**.
- **Scaled** by a sensitivity (`x0.5` for a radius from a diameter).
- **An ISO 286 class**: `- pin 10 g6`, `+ bore 30 H7`.
- **Limits**: `29.95 to 30.05`.
- **A geometric tolerance**: `position 0.1` counts as ±0.05 on the stack.

It also computes **ISO 286 fits**. Type `30 H7/g6` or `Ø25 H7/p6` to get:

- The hole and shaft limits.
- The minimum and maximum clearance or interference.
- The fit type.
- For transition fits, the chance of interference.

It's made for:

- Mechanical and design engineers checking assemblies before the drawings go out.
- Quality and manufacturing engineers setting tolerances and judging yield.
- 3D-printing and machining shops, and engineering students.
- AI agents that need a real stack-up instead of a guess.

![The shaft end-play stack analyzed by this Actor: the Monte Carlo histogram of the gap with the 0.05 to 0.5 mm requirement, the worst case from -0.03 to 0.38 mm and RSS from 0.057 to 0.293 mm, and the housing depth driving 71% of the variation](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/tolerance-stackup-analyzer-example.png?signature=118bPTRZACQLGXpYTgVlX)

### How to use it

1. Write **Stacks**, one per entry, or **Fits**, one per line. The form has examples.
2. Optionally set a **Default requirement** or the **Units** (mm or inches).
3. Click **Start**. Each stack or fit is a row in the results, with its summary, chart and report.

#### Writing a stack

Separate the dimensions with semicolons or new lines. Go around the loop and give each dimension a sign:

- `+` for one that opens the gap.
- `-` for one that closes it.

Then the name, the nominal and the tolerance:

| You write | It means |
|---|---|
| `+ housing 50 ±0.1` | 49.9 to 50.1 |
| `- spacer 19.8 +0.05/-0` | 19.8 to 19.85 |
| `- ring 0.5 -0.01/-0.03` | 0.47 to 0.49 |
| `+ slot 10.2 to 10.3` | limits |
| `- pin 10 g6` | ISO 286: 9.986 to 9.995 |
| `- position 0.1` | ±0.05 around 0 |
| `- bore 12 ±0.02 x0.5` | half of a diameter (a radius) |
| `... uniform`, `... triangular`, `... Cpk 1.33`, `... sigma 0.01`, `... shift 0.01` | how the dimension varies |

The requirement goes in its own part:

- A range: `gap 0.05 to 0.5`.
- One side: `clearance min 0`, `max 0.3`, `gap ≥ 0.1`.
- A nominal and tolerance: `gap 0.2 ±0.15`.

A title can lead: `Shaft end play: + housing 50 ±0.1; ...`. Objects work too; see Input.

### Examples

All of these ran on this Actor; the numbers are from the results.

| Stack or fit | Result |
|---|---|
| `Shaft end play: + housing depth 50 ±0.1; - bearing width 20 ±0.05; - spacer 19.8 +0.05/-0; - bearing width 10 ±0.03; gap 0.05 to 0.5` | Worst case -0.03 to 0.38 fails. RSS 0.057 to 0.293 has Cpk 1.06 and 771 ppm out; Monte Carlo has 765 ppm. The housing drives 71%. Tolerances at 61% would meet the worst case, and moving the mean by +0.1 would center it |
| `Pin in slot: + slot 10.2 to 10.3; - pin 10 g6; - position 0.1; clearance min 0` | The g6 pin is 9.986 to 9.995. Worst case 0.155 to 0.364 always clears; RSS Cpk 3.66 |
| `Lid gap`: box 80 ±0.3, insert 76 ±0.2 uniform, gasket 3 +0.2/-0.1 at Cpk 1.33, gap 0.2 to 1.8 | Mean 0.95. Worst case 0.3 to 1.6 fits. RSS Cpk 1.59; the uniform insert drives 54% |
| `+ A 25 ±0.2; - B 10 ±0.2; - C 14.6 ±0.1 uniform; gap 0.1 to 0.6` | Worst case -0.1 to 0.9 fails. RSS has 3.85% out and Monte Carlo 3.7%; tolerances at 40% would meet the worst case |
| `30 H7/g6` | Clearance fit: hole 30.000 to 30.021, shaft 29.980 to 29.993, clearance 7 to 41 µm |
| `25 H7/p6` | Interference fit, 1 to 35 µm |
| `40 H7/k6` | Transition fit, from 18 µm interference to 23 µm clearance; 30.7% of assemblies interfere when both parts are normal over their bands |

The tests check that:

- 15 tolerance classes match the ISO 286-2 tables, holes and shafts, from 3 to 200 mm (including the Δ rule for K, M, N and P holes).
- Worst case and RSS match hand sums, and Monte Carlo matches the normal theory within 2%.
- Uniform and triangular sigmas, sensitivities, Cp, Cpk, normal ppm and scaling match their formulas.
- Every text form above is read correctly.

### How-to examples

Each example is a complete input; the results are from runs of the Actor (also listed under **Examples**).

#### How to do a tolerance stack-up (worst case, RSS and Monte Carlo)

```json
{"stacks": ["Shaft end play: + housing depth 50 ±0.1; - bearing width 20 ±0.05; - spacer 19.8 +0.05/-0; - bearing width 10 ±0.03; gap 0.05 to 0.5"]}
```

Result: worst case -0.03 to 0.38 fails; RSS 0.057 to 0.293 has Cpk 1.06 and 771 ppm out, and Monte Carlo 765 ppm. The housing drives 71%; tolerances at 61% would meet the worst case, and moving the mean by +0.1 would center it.

#### How to include an ISO fit and a position tolerance in a stack

```json
{"stacks": ["Pin in slot: + slot 10.2 to 10.3; - pin 10 g6; - position 0.1; clearance min 0"]}
```

Result: the g6 pin is 9.986 to 9.995; worst case 0.155 to 0.364 always clears, with RSS Cpk 3.66.

#### How to look up an ISO 286 hole and shaft fit

```json
{
  "fits": [
    "30 H7/g6",
    "40 H7/k6"
  ]
}
```

Result: 30 H7/g6 is a clearance fit: hole 30.000 to 30.021, shaft 29.980 to 29.993, clearance 7 to 41 µm. 40 H7/k6 is a transition fit, from 18 µm interference to 23 µm clearance; 30.7% of assemblies interfere.

#### How to let an AI agent check if parts fit

Add this Actor to the [Apify MCP server](https://mcp.apify.com) with `https://mcp.apify.com/?tools=jumblemog/tolerance-stackup-analyzer`. The agent writes the chain of dimensions as text and answers with the worst-case range, the yield and which dimension to tighten.

### FAQ

**Which tolerance forms can I write?** ±, unequal (`+0.05/-0`), limits (`10.2 to 10.3`), ISO classes (`10 g6`) and geometric tolerances such as `position 0.1`.

**What distributions does it use?** Normal by default, centered with σ = half-band / (3·Cpk); mark a dimension `uniform` or `triangular`, or give its `cpk`.

**Does it say what to change?** Yes: each dimension's share of the variation, how far the tolerances would have to scale to meet the requirement, and the mean shift that centers it.

**Which ISO 286 classes are covered?** 15 hole and shaft classes from 3 to 200 mm, checked against the ISO 286-2 tables, including the Δ rule for K, M, N and P holes.

### Input

| Field | What it is |
|---|---|
| `stacks` | Stacks, as text or objects. |
| `fits` | Fits or tolerance classes, one per line. |
| `requirement` | Default requirement for stacks that don't give one. |
| `units` | `mm` (default) or `in`. ISO classes need mm. |
| `charts` | Draw charts (default on). |

**A stack as an object** takes:

- `title`.
- `dimensions`: a list of text lines or objects.
- `requirement`: `"0.05 to 0.5"` or `{"min": 0.05, "max": 0.5}`; or `min` and `max` directly.
- `units`.
- `samples`: Monte Carlo draws, 1,000 to 1,000,000; default 200,000.
- `targetCpk`: default 1.33.
- `mrssFactor`: default 1.5.
- `seed`.

**A dimension as an object** takes:

- `name` and `nominal`.
- The tolerance, one of: `tolerance` (`"±0.1"`, `"+0.05/-0"` or a number), `plus` and `minus`, `min` and `max`, or `fit` (`"g6"`).
- `sign` (`+` or `-`) and `coefficient`.
- `distribution` (`normal`, `uniform`, `triangular`), `cpk`, `sigma` and `shift`.

**A fit as an object** takes `size` and either `fit` (`"H7/g6"`) or `hole` and/or `shaft`.

### Output

One dataset item per stack or fit, also saved together in the run's `OUTPUT` record:

```json
{
  "request": 1, "status": "ok", "type": "stack", "title": "Shaft end play", "units": "mm",
  "summary": "Nominal 0.2 mm (mean 0.175); worst case -0.03 to 0.38, which does not fit the 0.05 to 0.5 requirement; RSS ±3σ 0.05657 to 0.2934 (Cpk 1.06, 771 ppm out); Monte Carlo 0.0765% out of spec. Housing depth drives 71% of the variation; scaling every tolerance to 61% would meet the worst case.",
  "requirement": {"min": 0.05, "max": 0.5}, "nominal": 0.2, "mean": 0.175,
  "worstCase": {"min": -0.03, "max": 0.38, "range": 0.41, "meetsRequirement": false},
  "rss": {"mean": 0.175, "sigma": 0.03947573, "min": 0.056573, "max": 0.293427, "outOfSpecPercent": 0.077142,
          "ppm": 771.4, "cp": 1.8999, "cpk": 1.0555, "meetsTargetCpk": false},
  "monteCarlo": {"samples": 200000, "mean": 0.174954, "std": 0.03946839, "p00135": 0.055812, "p99865": 0.2939,
                 "outOfSpecPercent": 0.0765, "ppm": 765.0, "belowMinPercent": 0.0765, "aboveMaxPercent": 0.0},
  "dimensions": [{"name": "housing depth", "sign": "+", "nominal": 50.0, "plus": 0.1, "minus": -0.1,
                  "distribution": "normal", "sigma": 0.03333333, "worstCaseShare": 48.78, "varianceShare": 71.3}, "..."],
  "scaling": {"worstCase": 0.6098, "rssForTargetCpk": 0.7936, "targetCpk": 1.33, "centerShift": 0.1},
  "imageUrl": "https://api.apify.com/v2/key-value-stores/.../records/001-....png"
}
```

A fit has `fitType`, `hole` and `shaft` (deviations, limits and IT band), `minClearance` and `maxClearance` in mm (negative means interference), and `interferenceProbabilityPercent`. A request that can't be computed has `"status": "failed"` and the reason in `error`, and isn't billed.

### How it works

1. **Reading**: each part is a dimension or the requirement. Tolerances can be ±, unequal, limits, ISO classes or geometric tolerances.
2. **Worst case**: each dimension at the limit that pushes the gap down, then up.
3. **RSS**:
   - σ = √Σ(aᵢσᵢ)², with each dimension centered in its band.
   - Normal dimensions use σ = half-band / (3·Cpk). Uniform ones use half-band/√3, triangular ones half-band/√6.
   - Yield, ppm and Cpk come from the normal distribution.
4. **Monte Carlo**: NumPy draws every dimension from its distribution and adds the stack. The result gives the 0.135% and 99.865% points (the ±3σ equivalents) and the counted share out of spec.
5. **Scaling**: the room between the mean and the nearer limit, divided by the worst-case half-range or by 3·target Cpk·σ.
6. **ISO 286**:
   - IT grades and fundamental deviations come from ISO 286-1, with the values tabulated in ISO 286-2.
   - K, M, N and P holes get the Δ correction in the finer grades.
7. **Charts** are drawn with Vega-Lite and rendered with vl-convert.

### Pricing

You pay one low price per stack and a lower one per fit, at the prices shown on this page. They include the chart and the report. Requests that can't be computed are never charged. If you set a maximum cost per run, the Actor stops before a request that wouldn't fit.

### Speed

A stack with 200,000 Monte Carlo draws takes well under a second, and a fit a few milliseconds, plus the chart. A run through the API answers in about 5 to 10 seconds, including the cloud container starting.

### Tips and limits

- **One-dimensional stacks**: dimensions add along one direction with a sensitivity each. For angles or 3D geometry, work out each sensitivity (∂gap/∂dimension) and enter it as `x...`.
- **RSS assumes independent, centered dimensions.** With few dimensions or skewed processes, trust the worst case and Monte Carlo more. Use `shift` to model a process that runs off center.
- **Geometric tolerances** are entered as their ± effect on this one direction (position 0.1 → ±0.05). Bonus tolerance from material conditions isn't added.
- **ISO 286**: sizes up to 500 mm, holes D to P and JS, shafts d to p and js, grades IT1 to IT16.
- **Limits**: 200 dimensions per stack, 500 requests per run.

### For AI agents and developers

This Actor works with the [Apify MCP server](https://mcp.apify.com), so AI agents can call it as a tool. Pass `stacks` or `fits` as plain text and read `summary`, `worstCase.meetsRequirement`, `rss.cpk`, `monteCarlo.ppm` and `scaling`. A direct API call that waits for the answer:

```bash
curl -X POST "https://api.apify.com/v2/acts/jumblemog~tolerance-stackup-analyzer/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"stacks": ["+ case 40 ±0.15; - PCB 1.6 ±0.16; - standoff 35 ±0.1; - connector 3 ±0.05; gap min 0.1"], "fits": ["12 H7/h6"]}'
```

`run-sync` instead returns the run's `OUTPUT`: the status, the counts and every result as JSON.

In Python, with the `apify-client` package:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("jumblemog/tolerance-stackup-analyzer").call(run_input={
    "stacks": [{"title": "Lid gap", "requirement": {"min": 0.2, "max": 1.8}, "dimensions": [
        {"name": "box", "nominal": 80, "tolerance": "±0.3"},
        {"name": "insert", "nominal": 76, "tolerance": "±0.2", "sign": "-", "distribution": "uniform"},
        {"name": "gasket", "nominal": 3, "plus": 0.2, "minus": -0.1, "sign": "-", "cpk": 1.33}]}],
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["summary"])
```

### Credits

- Numbers: [NumPy](https://numpy.org) and [SciPy](https://scipy.org) (BSD-3-Clause).
- Charts: [Vega-Lite](https://vega.github.io/vega-lite/) and [vl-convert](https://github.com/vega/vl-convert) (BSD-3-Clause), with the [Inter](https://rsms.me/inter/) font (SIL Open Font License).
- Standards:
  - ISO 286-1 and ISO 286-2, *Geometrical product specifications (GPS): ISO code system for tolerances on linear sizes*.
  - The stack-up methods follow common practice, as in ASME Y14.5 users' guides and Fortini, *Dimensioning for Interchangeable Manufacture*.

# Actor input Schema

## `stacks` (type: `array`):

One stack per entry, as text or an object. Text: dimensions separated by semicolons or new lines, each with a sign (+ adds to the gap, - takes away), a name, a nominal and a tolerance: '+ housing 50 ±0.1', '- spacer 19.8 +0.05/-0', '- pin 10 g6' (ISO 286), '+ slot 10.2 to 10.3', '- position 0.1', plus 'uniform', 'triangular', 'Cpk 1.33', 'sigma 0.01' or 'x0.5' (sensitivity). The requirement: 'gap 0.05 to 0.5', 'clearance min 0', 'max 0.3'. A title can lead: 'Shaft end play: ...'. Object fields: title, dimensions (text or objects with name, nominal, tolerance or plus/minus or min/max or fit, sign, coefficient, distribution, cpk, sigma, shift), requirement ('0.05 to 0.5' or {min, max}), units, samples, targetCpk.

## `fits` (type: `array`):

ISO 286 fits or tolerance classes, one per line: '30 H7/g6', 'Ø25 H7/p6', '20 k6'. Sizes in mm up to 500. Holes D to P and JS, shafts d to p and js, grades IT1 to IT16.

## `requirement` (type: `string`):

For stacks that don't give one, such as '0.05 to 0.5' or 'min 0'.

## `units` (type: `string`):

The unit the stacks are written in. ISO 286 fit classes need millimetres.

## `charts` (type: `boolean`):

The Monte Carlo histogram and contributions for each stack, and the tolerance zones for each fit.

## Actor input object example

```json
{
  "stacks": [
    "Shaft end play: + housing depth 50 ±0.1; - bearing width 20 ±0.05; - spacer 19.8 +0.05/-0; - bearing width 10 ±0.03; gap 0.05 to 0.5",
    "Pin in slot: + slot 10.2 to 10.3; - pin 10 g6; - position 0.1; clearance min 0",
    {
      "title": "Lid gap",
      "dimensions": [
        {
          "name": "box height",
          "nominal": 80,
          "tolerance": "±0.3",
          "sign": "+"
        },
        {
          "name": "insert height",
          "nominal": 76,
          "tolerance": "±0.2",
          "sign": "-",
          "distribution": "uniform"
        },
        {
          "name": "gasket",
          "nominal": 3,
          "tolerance": "+0.2/-0.1",
          "sign": "-",
          "cpk": 1.33
        }
      ],
      "requirement": {
        "min": 0.2,
        "max": 1.8
      }
    }
  ],
  "fits": [
    "30 H7/g6",
    "25 H7/p6",
    "40 H7/k6"
  ],
  "units": "mm",
  "charts": true
}
```

# Actor output Schema

## `results` (type: `string`):

One row per stack or fit: the summary and chart.

## `output` (type: `string`):

The OUTPUT record: every result in one JSON object.

## `files` (type: `string`):

Charts (PNG and SVG) and Markdown reports in the run's key-value store.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "stacks": [
        "Shaft end play: + housing depth 50 ±0.1; - bearing width 20 ±0.05; - spacer 19.8 +0.05/-0; - bearing width 10 ±0.03; gap 0.05 to 0.5",
        "Pin in slot: + slot 10.2 to 10.3; - pin 10 g6; - position 0.1; clearance min 0",
        {
            "title": "Lid gap",
            "dimensions": [
                {
                    "name": "box height",
                    "nominal": 80,
                    "tolerance": "±0.3",
                    "sign": "+"
                },
                {
                    "name": "insert height",
                    "nominal": 76,
                    "tolerance": "±0.2",
                    "sign": "-",
                    "distribution": "uniform"
                },
                {
                    "name": "gasket",
                    "nominal": 3,
                    "tolerance": "+0.2/-0.1",
                    "sign": "-",
                    "cpk": 1.33
                }
            ],
            "requirement": {
                "min": 0.2,
                "max": 1.8
            }
        }
    ],
    "fits": [
        "30 H7/g6",
        "25 H7/p6",
        "40 H7/k6"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("jumblemog/tolerance-stackup-analyzer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "stacks": [
        "Shaft end play: + housing depth 50 ±0.1; - bearing width 20 ±0.05; - spacer 19.8 +0.05/-0; - bearing width 10 ±0.03; gap 0.05 to 0.5",
        "Pin in slot: + slot 10.2 to 10.3; - pin 10 g6; - position 0.1; clearance min 0",
        {
            "title": "Lid gap",
            "dimensions": [
                {
                    "name": "box height",
                    "nominal": 80,
                    "tolerance": "±0.3",
                    "sign": "+",
                },
                {
                    "name": "insert height",
                    "nominal": 76,
                    "tolerance": "±0.2",
                    "sign": "-",
                    "distribution": "uniform",
                },
                {
                    "name": "gasket",
                    "nominal": 3,
                    "tolerance": "+0.2/-0.1",
                    "sign": "-",
                    "cpk": 1.33,
                },
            ],
            "requirement": {
                "min": 0.2,
                "max": 1.8,
            },
        },
    ],
    "fits": [
        "30 H7/g6",
        "25 H7/p6",
        "40 H7/k6",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("jumblemog/tolerance-stackup-analyzer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "stacks": [
    "Shaft end play: + housing depth 50 ±0.1; - bearing width 20 ±0.05; - spacer 19.8 +0.05/-0; - bearing width 10 ±0.03; gap 0.05 to 0.5",
    "Pin in slot: + slot 10.2 to 10.3; - pin 10 g6; - position 0.1; clearance min 0",
    {
      "title": "Lid gap",
      "dimensions": [
        {
          "name": "box height",
          "nominal": 80,
          "tolerance": "±0.3",
          "sign": "+"
        },
        {
          "name": "insert height",
          "nominal": 76,
          "tolerance": "±0.2",
          "sign": "-",
          "distribution": "uniform"
        },
        {
          "name": "gasket",
          "nominal": 3,
          "tolerance": "+0.2/-0.1",
          "sign": "-",
          "cpk": 1.33
        }
      ],
      "requirement": {
        "min": 0.2,
        "max": 1.8
      }
    }
  ],
  "fits": [
    "30 H7/g6",
    "25 H7/p6",
    "40 H7/k6"
  ]
}' |
apify call jumblemog/tolerance-stackup-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jumblemog/tolerance-stackup-analyzer"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/w08Xe9y5VVAVEiuy6/builds/k8eqt81uWUnvElexQ/openapi.json
