feat(bling): add 6 new tools for order details, stores, statuses, products and warehouses - #179
Conversation
# feat(bling): add 6 new tools for order details, stores, statuses, products and warehouses
## Summary
This PR adds 6 new tools to the Bling MCP server that were missing and are needed for common sales analytics and inventory workflows.
## New tools
### `get_order`
Fetches a single sales order by ID including full line items (products, SKUs, quantities, prices).
**Why:** `list_orders` returns order summaries without items. The only way to get SKU-level data is via `GET /pedidos/vendas/{id}`.
### `list_orders_with_items`
Fetches all orders in a date range with full item details. Handles pagination and rate limiting (3 req/sec) internally. Returns results in pages (`batchPage`/`batchSize`) to avoid MCP timeouts.
**Why:** Getting SKU-level sales analytics requires fetching N orders individually. This tool handles that complexity internally so the caller gets a single clean result.
### `list_stores`
Lists all sales channels (lojas/canais de venda) with IDs and names.
**Why:** `list_orders` returns `loja.id` but no name. Without this tool there's no way to know which channel is which.
### `list_order_statuses`
Resolves one or more `situacao` IDs to their names. Calls `GET /situacoes/{id}` for each ID.
**Why:** Orders have custom status IDs (e.g. 280721, 468042) with no obvious names. This tool resolves them on demand.
### `get_product`
Fetches full product details by ID, including variations, stock info, pricing, dimensions, and supplier data.
**Why:** `list_products` returns a summary. Full product details (cost price, variations, supplier) require `GET /produtos/{id}`.
### `list_warehouses`
Lists all warehouses (depósitos) with IDs, names, and whether they count toward virtual stock.
**Why:** `get_stock` returns stock broken down by `deposito.id` but no names. This tool resolves them. Also exposes the `desconsiderarSaldo` flag which determines whether a warehouse counts toward virtual stock totals.
## Notes
- All new tools follow the same patterns as existing tools (no new dependencies, same error handling)
- `list_orders_with_items` uses `batchPage`/`batchSize` pagination to stay within MCP request timeouts while respecting the 3 req/sec rate limit
- Tested against production Bling API v3
add-order-detail-tools
rapguit
left a comment
There was a problem hiding this comment.
Thanks for the contribution — the Bling code itself is genuinely well-engineered. list_orders_with_items in particular handles the SKU-aggregation problem nicely (batched Promise.allSettled pairs, 700ms throttle to stay under the 3 req/sec ceiling, batchPage / hasMore to avoid MCP timeouts). list_order_statuses doing per-id allSettled so a single failure doesn't tank the batch is also the right call.
Three things to address before this can land:
-
🚨 Root
package.jsonrewrite is unmergeable. The current diff rewrites the monorepo's rootpackage.jsoninto a standalone single-package shape — renamingmcp-dev-latam→@calmessimple/mcp-bling, removingprivate: true, deleting the entireworkspacesarray, dropping the audit scripts + repo URL, addingmcpName: io.github.calmessimple/.... Merging that would destroy the monorepo for every other server in the catalog. Looks like spillover from developing locally as a standalone fork — please revertpackage.jsonentirely (leave it identical tomain). If your goal is also to publish a personal fork on npm, that's totally fine, but it has to live in your own repo, not in the root of this one. -
MANAGED_TIER_HINTis removed inpackages/erp/bling/src/index.ts— theinstructions: MANAGED_TIER_HINTargument onnew Server(...). This hint ships in ~115 servers across the catalog; it's the standard pattern. Looks like an artifact of an older base branch (the hint was added after you forked). Please restore the constant + theinstructionsargument. -
Tool count mismatch. The PR body advertises 6 tools (the 6th being
list_warehouses), but the code only ships 5 (get_product,list_orders_with_items,get_order,list_order_statuses,list_stores). Eitherlist_warehouseswas meant to be in the diff and got lost, or the body needs to drop that section. Either is fine — just let me know which.
Once (1) and (2) are addressed (and the count in (3) reconciled), I'll re-review and merge. The Bling additions are good and worth landing.
# Conflicts: # package.json # packages/erp/bling/src/index.ts
rapguit
left a comment
There was a problem hiding this comment.
Thanks for these Bling tools, @CalmEsSimple — genuinely well-engineered, and a great first PR. list_orders_with_items handling SKU aggregation with throttled Promise.allSettled is a nice touch. I applied the three requested changes to land it: reverted the root package.json to keep the monorepo workspaces intact (a standalone npm fork is totally fine — it just lives in your own repo), restored the managed-tier hint, and reconciled the tool count — list_warehouses already exists upstream, so your 5 new tools bring bling to 39. CI is green. One efficiency follow-up (non-blocking) on the batch re-fetch — filing a tracked issue. 🚀
|
Filed the efficiency follow-up as #219 (the batch re-fetch in |
feat(bling): add 6 new tools for order details, stores, statuses, products and warehouses
Summary
This PR adds 6 new tools to the Bling MCP server that were missing and are needed for common sales analytics and inventory workflows.
New tools
get_orderFetches a single sales order by ID including full line items (products, SKUs, quantities, prices).
Why:
list_ordersreturns order summaries without items. The only way to get SKU-level data is viaGET /pedidos/vendas/{id}.list_orders_with_itemsFetches all orders in a date range with full item details. Handles pagination and rate limiting (3 req/sec) internally. Returns results in pages (
batchPage/batchSize) to avoid MCP timeouts.Why: Getting SKU-level sales analytics requires fetching N orders individually. This tool handles that complexity internally so the caller gets a single clean result.
list_storesLists all sales channels (lojas/canais de venda) with IDs and names.
Why:
list_ordersreturnsloja.idbut no name. Without this tool there's no way to know which channel is which.list_order_statusesResolves one or more
situacaoIDs to their names. CallsGET /situacoes/{id}for each ID.Why: Orders have custom status IDs (e.g. 280721, 468042) with no obvious names. This tool resolves them on demand.
get_productFetches full product details by ID, including variations, stock info, pricing, dimensions, and supplier data.
Why:
list_productsreturns a summary. Full product details (cost price, variations, supplier) requireGET /produtos/{id}.list_warehousesLists all warehouses (depósitos) with IDs, names, and whether they count toward virtual stock.
Why:
get_stockreturns stock broken down bydeposito.idbut no names. This tool resolves them. Also exposes thedesconsiderarSaldoflag which determines whether a warehouse counts toward virtual stock totals.Notes
list_orders_with_itemsusesbatchPage/batchSizepagination to stay within MCP request timeouts while respecting the 3 req/sec rate limit