Tool collections: coarse-grained grouping with progressive disclosure
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript
- Lĩnh vực
- api
Hướng nghiên cứu
Start by reading this proposal alongside #199, #161, #227, and #135 to understand the related registry, skills, and cross-document discussions. The issue proposes adding registerCollection() while preserving registerTool() and getTools() behavior; define what collection registration and discovery should guarantee, including identity across navigation and server roundtrips. Done means the proposal has a settled API and behavior that address progressive disclosure and compatibility.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In a large JS application, the number of registered tools grows fast. Tools accumulate across routes, across features, and across client/server boundaries. A moderately complex app can easily surface 100+ tools (see also #88, where an MCP bridge exposes 50+ from a single server). Today getTools() hands the agent one flat list, which means:
- The agent must read every tool description to find the 3 it needs, spending tokens on tools that are irrelevant to the current task.
- As the tool list grows, the accuracy of the model selection will decrease. This was a well-documented failure mode for large flat tool lists in backend MCP, and it's why progressive disclosure patterns (tool search, toolsets) have emerged in backend MCP.
- There's no unit between "one tool" and "every tool on the page."
Applications already have natural coarse-grained groupings: an auth flow (sign-in, sign-out, verify-2fa, recover-account), a cart flow (add-to-cart, remove-from-cart, apply-promo, begin-checkout), a video experience (play, seek, set-captions, set-speed). What's missing is a way to expose that structure so an agent can read a handful of group descriptions first, pick the relevant one, and only then drill into those tools.
There's a second problem this addresses. When a tool execution spans a client/server interaction, or across tabs, the tool call triggers a navigation or a server roundtrip, and tools re-register on the way back. We've sometimes observed agents failing to re-find the relevant tools after the roundtrip. A collection whose identity persists (from cart count/data to server to success/error) improves continuity.
Strawman
Keep registerTool() as-is and add a collection primitive alongside it:
document.modelContext.registerCollection({
name: "cart-checkout",
description: "Create cart, process order, report to user",
tools: ["cart-inventory", "confirm-payment", "process-cart-order", "get-order-status", "cancel-order", "cart-success", "cart-error"],
});
Benefits:
- Backwards compatible, and keeps the existing API simple. Agents that don't understand collections call getTools() and get the flat list they get today. Tools registered without a collection remain top-level. Collections are additive structures that preserve the current API.
- Deterministic. A collection is a defined set, defined by the application owner. It doesn’t require natural-language interpretation. Devs can define this according to how they would like their application to be used.
- Cheap for the agent. The initial payload is smaller, the agent doesn’t have to process non-related tools for task completion.
- Can help with cross-document, and cross-tab actions. We need tools to outlive a single document view: #227 extends discovery across the browsing context group, and #135 discusses cross-document tool responses. A collection could provide cohesion beyond a navigation or server roundtrip. The agent could have some continuity of defined tools instead of re-reading an entire flat list.
Frameworks
Filing this partly as a sub-topic of the frameworks meta issue (#199, section 2: scoped, composable registries). This could fit well into Framework mental-models.
Alternatives considered: Skills (#161)
#161 proposes skills that bundle tools with workflow instructions and structured context, and grouping falls out of that as a side effect (tools: ["searchProducts", "addToCart", ...]). Skills are solving a real problem, but I don't think they're the right home for grouping, for two reasons:
- Creates two API surface areas to think about: If grouping only exists via skills, a developer who just wants to expose their cart tools has to reach for a primitive whose main job is behavioral guidance, and every framework integration has to reason about both surfaces. Grouping is structural and could live with tool registration itself, where you’re already defining it.
- Determinism: As I alluded to above, a skill's
instructionsfield leaves room for LLM-based agents to interpret, which clients may weigh differently or ignore completely. Developers need a consistent, enumerable way to expose groupings that behave the same in every client.
- Ngôn ngữ chính
- Bikeshed
- Star
- 4.7k
- Fork
- 328
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của webmachinelearning/webmcp
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
webmachinelearning/webmcp#360 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Say how an agent should weigh annotations that the page wrote about itselfCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
webmachinelearning/webmcp#353 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
webmachinelearning/webmcp#343 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Agenda+ i18n-tracker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
webmachinelearning/webmcp#273 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
a11y-tracker Agenda+
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
webmachinelearning/webmcp#272 · 4 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của webmachinelearning/webmcp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
zach-blumenfeld/aip#13 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
endora-commerce/endora-commerce#397 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NVIDIA-Omniverse/usd-brep#23 ·
-
documentation good first issue hacktoberfest python
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Exact onnxruntime==1.27.0 core pin makes Pipecat-based apps uninstallable from the dashboardĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
pollen-robotics/reachy_mini#1493 ·
Maintainer thường phản hồi trong vòng 1 ngày