Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

tools-call-simple-text passes when the tool does not exist

未关闭
#515 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
devtools, testing

调研方向

Look at the conformance test scenario 'tools-call-simple-text' in the test suite. The bug is that it incorrectly accepts an error response as a success. Examine the test logic that checks the result, likely in a file handling MCP tool call scenarios. Understand how the test validates 'isError' and the content text. Run the provided minimal server to reproduce the issue, then modify the test to fail when 'isError' is true or when the tool is not found.

由索引模型根据 Issue 内容生成。

描述

tools-call-simple-text reports SUCCESS against a server that has no test_simple_text tool. The server's "not found" error result is accepted as "returns simple text content".

Reproduced on 0.1.16 and 0.2.0-alpha.11.

Server: a minimal Streamable HTTP server on the official TypeScript SDK with one tool, get_forecast (full source below).

npx @modelcontextprotocol/conformance server --url http://127.0.0.1:3932/mcp --scenario tools-call-simple-text
# Passed: 1/1 (0.1.16), Passed: 2/2 (0.2.0-alpha.11)

checks.json records the evidence for the pass:

{"id":"tools-call-simple-text","status":"SUCCESS",
 "details":{"result":{"content":[{"type":"text","text":"MCP error -32602: Tool test_simple_text not found"}],"isError":true}}}

Expected: FAILURE (or not-applicable) when the result has isError: true, and ideally a check that the text is the fixture's expected text. As it stands, any server that answers an unknown tool with an isError text result passes. That is every server built on the TypeScript SDK.

This looks like the same class of bug as #505, where a scenario accepts tool-error results in place of the success it is meant to verify. The other tools-call-* scenarios may be worth auditing for the same thing.

minimal.mjs
import express from "express";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import { z } from "zod";

function build() {
  const s = new McpServer({ name: "weather", version: "1.0.0" });
  s.tool("get_forecast", "Get the forecast for a city.", { city: z.string() },
    { readOnlyHint: true }, async ({ city }) => ({ content: [{ type: "text", text: `Sunny in ${city}` }] }));
  return s;
}
const app = express();
app.use(express.json());
app.post("/mcp", async (req, res) => {
  const server = build();
  const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
  res.on("close", () => { transport.close(); server.close(); });
  await server.connect(transport);
  await transport.handleRequest(req, res, req.body);
});
app.get("/mcp", (req, res) => res.status(405).end());
app.listen(Number(process.env.PORT), "127.0.0.1");
主要语言
TypeScript
星标
127
派生
101
平均合并
4 天 7 小时
30 天内合并 PR
6

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/conformance 的其他 Issue

查看 modelcontextprotocol/conformance 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。