Skip to content

Commit 4fcabca

Browse files
committed
feat(meta-tools): guide @mux to optimize minimal-first, expand on demand
Composing a toolset was slow because the model would dump the whole catalog (mcpmux_list_all_tools), reason over all of it, then build one large FeatureSet upfront. Steer it toward a lean, incremental strategy in the guidance the model actually reads: - Server instructions: add an explicit "start minimal and expand on demand" directive — search for just the tools the task needs, compose a small FeatureSet, then grow it later (manage_feature_set update + add) only as new needs arise. Don't over-curate; re-optimizing is cheap. - mcpmux_list_all_tools description: point to mcpmux_search_tools for the common case; call out the full dump as the most token-heavy read. - mcpmux_manage_feature_set description: prefer a small initial set expanded later over adding every candidate tool upfront. Guidance-only; no behavior change to the tools themselves. Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent b90b05c commit 4fcabca

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

crates/mcpmux-gateway/src/mcp/handler.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,16 @@ impl ServerHandler for McpMuxGatewayHandler {
368368
list_feature_sets) are safe to call freely once the user has opted \
369369
in; writes (manage_feature_set, bind_current_workspace) prompt the \
370370
user for approval. Most operations accept an optional `space_id` \
371-
(from mcpmux_list_spaces) to target a specific Space."
371+
(from mcpmux_list_spaces) to target a specific Space.\n\n\
372+
When optimizing, start minimal and expand on demand. Use \
373+
`mcpmux_search_tools` to find just the tools the current task needs \
374+
and compose a small FeatureSet, then grow it later \
375+
(`mcpmux_manage_feature_set` action 'update' with `add`) only as new \
376+
needs arise. Prefer this over dumping the whole catalog with \
377+
`mcpmux_list_all_tools` and adding everything upfront — a lean set is \
378+
faster to assemble, cheaper in tokens, and keeps the agent's tool \
379+
list focused. Don't over-curate: a few clearly-needed tools now beats \
380+
an exhaustive set, and re-optimizing is cheap."
372381
.to_string(),
373382
);
374383
info

crates/mcpmux-gateway/src/services/meta_tools/tools.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ impl MetaTool for ListAllToolsTool {
116116
fn description(&self) -> &'static str {
117117
"List every tool installed in a Space (default: the caller's resolved \
118118
Space; pass `space_id` to target another), without the current \
119-
FeatureSet filter applied. Use this to see what could be exposed \
120-
before composing a custom FeatureSet. Returns an array of \
121-
{server_id, qualified_name, description, available}."
119+
FeatureSet filter applied. Prefer `mcpmux_search_tools` for the common \
120+
case — only fall back to this full catalog dump when you genuinely need \
121+
to enumerate everything, since it's the most token-heavy read. Returns \
122+
an array of {server_id, qualified_name, description, available}."
122123
}
123124

124125
fn input_schema(&self) -> Value {
@@ -716,7 +717,9 @@ impl MetaTool for ManageFeatureSetTool {
716717
(needs `feature_set_id`). Tool names are the qualified names from \
717718
`mcpmux_list_all_tools`/`mcpmux_search_tools`. Built-in sets can't be \
718719
modified. Requires user approval. Route a workspace through a FeatureSet \
719-
with `mcpmux_bind_current_workspace`."
720+
with `mcpmux_bind_current_workspace`. Prefer composing a small initial \
721+
set and expanding it later (action 'update' with `add`) as the task \
722+
needs more, rather than adding every candidate tool upfront."
720723
}
721724

722725
fn input_schema(&self) -> Value {

0 commit comments

Comments
 (0)