Reusing and invoking existing code remains costly and unreliable, as most practical tools are embedded in heterogeneous code repositories and lack standardized, executable interfaces. Although large language models (LLMs) and Model Context Protocol (MCP)-based tool invocation frameworks enable natural language task execution, current approaches rely heavily on manual tool curation and standardization, which fundamentally limits scalability. In this paper, we propose ToolRosetta, a unified framework that automatically translates open-source code repositories and APIs into MCP-compatible tools that can be reliably invoked by LLMs. Given a user task, ToolRosetta autonomously plans toolchains, identifies relevant codebases, and converts them into executable MCP services, enabling end-to-end task completion with minimal human intervention. In addition, ToolRosetta incorporates a security inspection layer to mitigate risks inherent in executing arbitrary code. Extensive experiments across diverse scientific domains demonstrate that ToolRosetta can automatically standardize a large number of open-source tools and reduce the human effort required for code reproduction and deployment. Notably, by seamlessly leveraging specialized open-source tools, ToolRosetta-powered agents consistently improve task completion performance compared to commercial LLMs and existing agent systems.
翻译:复用和调用现有代码仍然成本高昂且不可靠,因为大多数实用工具都嵌入在异构的代码仓库中,缺乏标准化、可执行的接口。尽管大型语言模型(LLMs)和基于模型上下文协议(MCP)的工具调用框架能够实现自然语言任务执行,但当前方法严重依赖人工工具整理与标准化,这从根本上限制了可扩展性。本文提出ToolRosetta,这是一个统一框架,能够自动将开源代码仓库和API转换为MCP兼容的工具,从而可由LLMs可靠调用。给定用户任务后,ToolRosetta能自主规划工具链、识别相关代码库,并将其转换为可执行的MCP服务,实现端到端任务完成且仅需最少人工干预。此外,ToolRosetta集成了安全检查层,以缓解执行任意代码所固有的风险。跨多个科学领域的广泛实验表明,ToolRosetta能够自动标准化大量开源工具,并显著减少代码复现与部署所需的人力投入。值得注意的是,通过无缝利用专业开源工具,由ToolRosetta驱动的智能体在任务完成性能上持续优于商用LLMs及现有智能体系统。