# 2D Guillotine Packer MCP for AI Agents MCP

> 2D Guillotine Packer helps you figure out exactly where to place rectangular shapes inside a fixed area. If you're building a sprite sheet for a game, designing a complex UI, or trying to minimize waste in a manufacturing layout, this MCP handles the math. It checks if your items fit, calculates how much space you're wasting, and gives you the specific coordinates for every piece.

## Overview
- **Category:** utilities
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_QE7g1HY0ehCZ2CR6LMkpqQ3mw9PuboVh52TfHu6g/mcp
- **Tags:** bin-packing, guillotine, rectangles, layout, algorithm

## Description

This MCP helps you figure out exactly where to place rectangular shapes inside a fixed area without having to do the math yourself. When you're trying to fit a bunch of different sized boxes into a single container, the geometry gets messy fast. You don't want to spend hours manually dragging elements around or guessing which orientation saves the most space. This tool takes that headache off your plate by applying the Guillotine split algorithm to your layout problems. It treats your container like a canvas and your items like puzzle pieces, partitioning the empty space into smaller rectangles every time a new item is placed. You can use it to automate the creation of sprite sheets for games, figure out how to cut materials with the least amount of scrap in a factory, or organize complex UI components in an app. Because Vinkius hosts this tool, you can plug it directly into your existing agent setup to handle these geometric calculations instantly. Instead of your agent guessing where things go, it gets precise coordinates and density reports. It's about moving from a manual process of "I hope this fits" to an automated system of "Here is the exact layout." This is a huge win for anyone dealing with spatial constraints, as it turns a visual guessing game into a predictable, repeatable calculation. Whether you are trying to maximize profit in a warehouse or just trying to make sure your app's buttons don't overlap, this tool provides the logic you need.

## Tools

### calculate_packing_density
See what percentage of your total container area is actually filled by your items. It helps you monitor how much space you have left.

### pack_rectangles
This tool gives you the exact X and Y coordinates for every rectangle in your set to fit inside a box. It automates the placement of your items perfectly.

### validate_item_compatibility
Use this to run a quick check to see if any single item is physically too large to fit in your container. It prevents errors before you start packing.

## Prompt Examples

**Prompt:** 
```
I have a 500x500 area. Can I fit a 200x300, 100x100, and 50x50 box in there?
```

**Response:** 
```
Yes, those items will fit easily. Here is how you can arrange them:

- Item 1 (200x300): (0, 0)
- Item 2 (100x100): (200, 0)
- Item 3 (50x50): (300, 0)

You're using about 10% of the total area.
```

**Prompt:** 
```
Check if a 1000x1000 square fits in a 800x800 space.
```

**Response:** 
```
No, that won't work. The 1000x1000 square is too large for your 800x800 container. You'll need to either shrink the item or find a larger container.
```

**Prompt:** 
```
What's the density of my current layout?
```

**Response:** 
```
Based on the items you've placed so far, your packing density is 0.72. That means you're using 72% of your available space. You have room for more items or could try a tighter arrangement.
```

## Capabilities

### Place rectangles in a container
The MCP determines the exact X and Y coordinates for a set of 2D shapes within a bounding box.

### Get packing density reports
It calculates what percentage of your total container area is actually occupied by your items.

### Check item compatibility
The tool runs a quick pre-check to see if any single item is too large to fit in your container.

### Partition empty space
It splits remaining areas into smaller sub-rectangles as each item is placed.

### Automate layout coordinates
You get a complete list of positions for every item in your set in a single request.

### Verify layout feasibility
It confirms whether a collection of items can be arranged without overlapping or exceeding boundaries.

## Use Cases

### Fitting game assets onto a texture
A game developer needs to fit 40 different character animations onto a single 2048x2048 texture to save memory.

### Reducing scrap in material cutting
A furniture maker wants to know how many chair legs they can cut from a single sheet of plywood without wasting wood.

### Organizing UI components in a dashboard
A web designer is trying to fit 12 different sized widgets into a sidebar without any of them overlapping or overflowing.

### Arranging photos in a collage
An artist is organizing a collage of various sized photos into a specific rectangular frame and needs the exact positions for every image.

## Benefits

- Stop guessing where to put items. Use pack_rectangles to get precise coordinates for every shape in your set instantly. This removes the manual trial and error from your layout process.
- Minimize wasted materials. Use calculate_packing_density to see exactly how much area you're using and identify gaps. It helps you spot inefficiencies in your material plans quickly.
- Catch errors early. Use validate_item_compatibility to stop your workflow before you try to pack items that are simply too big. It saves time by catching impossible layouts in seconds.
- Automate sprite sheet creation. Let your agent handle the tedious math of fitting multiple game assets into a single texture. You get a perfectly packed sheet every time.
- Optimize manufacturing cuts. Get a clear picture of how to arrange parts on a sheet to reduce scrap and save money. It turns complex spatial planning into a simple calculation.

## How It Works

The bottom line is you get a mathematically optimized layout for any set of 2D shapes.

1. Provide the dimensions of your container and the list of rectangles you need to pack.
2. The MCP processes the items using the Guillotine split algorithm to find the best fit.
3. You receive a list of coordinates for every item and a report on the total packing density.

## Frequently Asked Questions

**What is the 2D Guillotine Packer used for?**
It's a tool for arranging rectangles in a space. Use it for making sprite sheets, designing UI layouts, or planning how to cut materials like wood or fabric.

**Can I use 2D Guillotine Packer for 3D objects?**
No, this tool only works with 2D rectangles. It's designed for flat shapes and layouts.

**How does the 2D Guillotine Packer save me time?**
It automates the math of finding coordinates. Instead of you manually placing items, your agent gets the exact positions for you.

**Is the 2D Guillotine Packer good for manufacturing?**
Yes, it's great for calculating how to fit parts onto a sheet of material to reduce scrap and save money.

**Can I check if my items will fit before I try to pack them?**
Yes, you can use the compatibility check to see if any of your items are too big for the container before you start the process.

**Does 2D Guillotine Packer handle different shapes like circles?**
No, it only handles rectangles. If you have circles, you'll need to use their bounding box dimensions.

**How does the packing algorithm work?**
It uses a Guillotine split strategy. The algorithm sorts items by height in descending order and places them into available free rectangles, splitting any remaining space into two new smaller rectangles after each placement.

**Can items be rotated to improve fit?**
Yes, if the `canRotate` property is set to true for an item, the algorithm will attempt to swap its width and height if the original orientation does not fit in a free rectangle.

**What happens if an item cannot fit?**
If any single item in the input list cannot find a suitable free rectangle, the `pack_rectangles` tool returns a failure status and identifies the specific item ID that caused the error.