mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 04:14:30 +00:00
* feat(mcp): support tool-level directTools array and 3-state UI configuration * refactor(mcp): refine tool hint explanation and separate server instructions block * style(mcp): display tool count in header title and split option hints into 3 lines * style(mcp): update tools description paragraph and place bulk buttons on a separate row * fix(mcp): enforce excludeTools in proxy path and align direct-tool counts - Filter the per-agent tool registry by excludeTools at build time (DB cache and lazy-connect paths), so excluded tools are unreachable through the mcp proxy (call, search, list, describe) — matching pi-mcp-adapter where isToolAllowed gates both direct and gateway exposure. - Add shared isDirectTool predicate (matches original or prefixed name) used by both buildDirectTools and the proxy description counts, so the advertised direct/proxy counts can no longer drift from actual registration; toolCount now reflects allowed tools only. - Remove the legacy boolean directTools branch (no legacy data exists). - Drop the now-unused mcp_excluded_tools_hint i18n key and regenerate Paraglide messages. - Extend unit tests: excluded tools are not counted, listed, searched, or callable via the proxy; prefixed-name directTools configs count correctly.
29 lines
1.9 KiB
JavaScript
Generated
29 lines
1.9 KiB
JavaScript
Generated
/* eslint-disable */
|
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
|
|
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
|
|
|
/** @typedef {{}} Mcp_Tools_DescInputs */
|
|
|
|
const en_mcp_tools_desc = /** @type {(inputs: Mcp_Tools_DescInputs) => LocalizedString} */ () => {
|
|
return /** @type {LocalizedString} */ (`Configure how MCP tools are exposed to the agent. Proxy mode keeps context usage low by hiding tools behind an MCP proxy, while Direct mode exposes selected tools as native agent tools for better discovery and faster access. Use Direct mode for frequently used or critical tools, and keep large MCP servers behind the proxy to avoid unnecessary context overhead.`)
|
|
};
|
|
|
|
const zh_mcp_tools_desc = /** @type {(inputs: Mcp_Tools_DescInputs) => LocalizedString} */ () => {
|
|
return /** @type {LocalizedString} */ (`配置 MCP 工具向 Agent 的暴露方式。代理模式通过 MCP 代理隐匿工具,以保持较低的上下文占用;直连模式将选定工具直接作为 Agent 原生工具暴露,便于更好地发现与更快地调用。建议对高频或关键工具使用直连模式,对于大型 MCP 服务保持代理模式以避免不必要的上下文开销。`)
|
|
};
|
|
|
|
/**
|
|
* | output |
|
|
* | --- |
|
|
* | "Configure how MCP tools are exposed to the agent. Proxy mode keeps context usage low by hiding tools behind an MCP proxy, while Direct mode exposes selected ..." |
|
|
*
|
|
* @param {Mcp_Tools_DescInputs} inputs
|
|
* @param {{ locale?: "en" | "zh" }} options
|
|
* @returns {LocalizedString}
|
|
*/
|
|
export const mcp_tools_desc = /** @type {((inputs?: Mcp_Tools_DescInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Mcp_Tools_DescInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
|
if (locale === "en") return en_mcp_tools_desc(inputs)
|
|
return zh_mcp_tools_desc(inputs)
|
|
}); |