您的 MCP 不需要 30 种工具:它需要代码

written on August 18, 2025

撰写于 2025 年 8 月 18 日

I wrote a while back about why code performs better than MCP (Model Context Protocol) for some tasks. In particular, I pointed out that if you have command line tools available, agentic coding tools seem very happy to use those. In the meantime, I learned a few more things that put some nuance to this. There are a handful of challenges with CLI-based tools that are rather hard to resolve and require further examination.

我之前写过关于为什么 代码性能优于 MCP (模型上下文协议) 的一些任务。特别是,我指出如果你有可用的命令行工具,代理编码工具似乎非常乐意使用这些工具。与此同时,我学到了一些更多的东西,为此增添了一些细微差别。基于 CLI 的工具存在一些相当难以解决的挑战,需要进一步的研究。

In this blog post, I want to present the (not so novel) idea that an interesting approach is using MCP servers exposing a single tool, that accepts programming code as tool inputs.

在这篇博客文章中,我想提出一个(并不那么新颖)的想法,即使用MCP服务器暴露一个单一工具的有趣方法,该工具接受编程代码作为工具输入。

CLI Challenges

CLI 挑战

The first and most obvious challenge with CLI tools is that they are sometimes platform-dependent, version-dependent, and at times undocumented. This has meant that I routinely encounter failures when using tools on first use.

CLI 工具的第一个也是最明显的挑战是,它们有时依赖于平台、版本,并且有时没有文档。这意味着我在首次使用工具时经常遇到失败。

A good example of this is when the tool usage requires non-ASCII string inputs. For instance, Sonnet and Opus are both sometimes unsure how to feed newlines or control characters via shell arguments. This is unfortunate but ironically not entirely unique to shell tools either. For instance, when you program with C and compile it, trailing newlines are needed. At times, agentic coding tools really struggle with appending an empty line to the end of a file, and you can find some quite impressive tool loops to work around this issue.

一个很好的例子是当工具使用需要非 ASCII 字符串输入时。例如,Sonnet 和 Opus 有时不确定如何通过 shell 参数传递换行符或控制字符。这很不幸,但讽刺的是,这并不完全是 shell 工具所独有的。例如,当你用 C 编程并编译时,需要尾随换行符。有时,代理编码工具在向文件末尾附加空行时确实很挣扎,你可以找到一些相当令人印象深刻的工具循环来解决这个问题。

This becomes particularly frustrating when your tool is absolutely not in the training set and uses unknown syntax. In that case, getting agents to use it ca...

开通本站会员,查看完整译文。

trang chủ - Wiki
Copyright © 2011-2025 iteam. Current version is 2.147.1. UTC+08:00, 2025-11-06 06:46
浙ICP备14020137号-1 $bản đồ khách truy cập$