From b1ec9492ccc36c93091b5ac3613b627cbc57b460 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 15 Oct 2026 09:54:15 -0700 Subject: [PATCH 1/2] test(mcp): remove outdated middleware discovery assumptions --- .sampo/changesets/cantankerous-stormcaller-ahti.md | 5 +++++ posthog/test/mcp/test_fastmcp_v4.py | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .sampo/changesets/cantankerous-stormcaller-ahti.md diff --git a/.sampo/changesets/cantankerous-stormcaller-ahti.md b/.sampo/changesets/cantankerous-stormcaller-ahti.md new file mode 100644 index 000000000..feab7d081 --- /dev/null +++ b/.sampo/changesets/cantankerous-stormcaller-ahti.md @@ -0,0 +1,5 @@ +--- +pypi/posthog: patch +--- + +Fix FastMCP 4 middleware tests for tools discoverable through get_tool. diff --git a/posthog/test/mcp/test_fastmcp_v4.py b/posthog/test/mcp/test_fastmcp_v4.py index ac29c3a9f..1d5afe45c 100644 --- a/posthog/test/mcp/test_fastmcp_v4.py +++ b/posthog/test/mcp/test_fastmcp_v4.py @@ -152,7 +152,6 @@ def echo(context: str, conversation_id: str, llm_model: str) -> str: tool = Tool.from_function(echo) if source == "middleware": child.add_middleware(ToolInjectionMiddleware(tools=[tool])) - assert await child.get_tool("echo") is None else: child.add_tool(tool) server = FastMCP("example-app") if source == "mounted" else child @@ -225,7 +224,6 @@ def echo(text: str) -> str: server = FastMCP("example-middleware-tools") server.add_middleware(ToolInjectionMiddleware(tools=[Tool.from_function(echo)])) - assert await server.get_tool("echo") is None sink = FakeClient() instrument( server, From 5fc5a35a02d17cad8a701f0639dcffa805696044 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 15 Oct 2026 09:55:20 -0700 Subject: [PATCH 2/2] chore: remove changeset for test-only fix --- .sampo/changesets/cantankerous-stormcaller-ahti.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .sampo/changesets/cantankerous-stormcaller-ahti.md diff --git a/.sampo/changesets/cantankerous-stormcaller-ahti.md b/.sampo/changesets/cantankerous-stormcaller-ahti.md deleted file mode 100644 index feab7d081..000000000 --- a/.sampo/changesets/cantankerous-stormcaller-ahti.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -pypi/posthog: patch ---- - -Fix FastMCP 4 middleware tests for tools discoverable through get_tool.