| name | grainger-branch-stock |
| description | Find which Grainger branches hold stock of a filtered product set, using the ~325-branch availability map embedded in every category page. Use for same-day pickup questions and "who has these near me". |
| allowed-tools | Read, Bash(python3 *), mcp__claude-in-chrome__tabs_context_mcp, mcp__claude-in-chrome__tabs_create_mcp, mcp__claude-in-chrome__navigate, mcp__claude-in-chrome__get_page_text |
Branch stock
Every category page carries stock counts for ~325 Grainger branches in its
state island, for the current filter set, each with a ready-made URL to pin to
that branch. One page load answers "where in the country are these in stock"
without touching a branch selector.
Get the map
python3 scripts/grainger_fetch.py search "nitrile gloves" --save /tmp/g.html
python3 scripts/grainger_parse.py /tmp/g.html --branches --top-branches 20
{"branch_count": 324,
"top": [{"branch_id": "216", "count": 339, "selected": false, "url": "/category/…&branchAvailability=216&filters=attrs,branchAvailability&…"}]}
count is how many distinct SKUs in the current filtered set that branch
stocks — not units, and not the whole catalogue. Narrow the facets first, or the
ranking answers a question nobody asked.
The gap you will hit immediately
The state carries branch IDs only — no names, no cities, no addresses. Branch
216 is not identified anywhere in the island, and there is no scripted route to the
branch directory. The roster also varies between queries — 324 and 325 observed on
the same day — so don't cache it as fixed.
To resolve an ID to a place, open the branch-pinned url in the browser and read
the rendered branch header. Do that for the handful you actually care about, not
for the whole roster.
If the user asked about a specific city, work the other way round: find their
branch in the browser once, note its ID, then use the scripted tier from then on.
Pinning
Append to any category URL:
&branchAvailability={id}&filters=attrs,branchAvailability
filters= must list both attrs and branchAvailability when combining a
branch with facets, or the branch filter is silently dropped and you get national
results that look like branch results.
Reporting
Give branch ID, resolved location if you looked it up, and the count with its
scope stated — "14 of the 581 nitrile-glove SKUs", not "14 in stock". Say plainly
that counts are SKU coverage, not quantity on the shelf, and that only the
browser can confirm a specific item is physically there today.