docs for client and for fastmcp patches

This commit is contained in:
lda
2026-05-17 00:12:52 +07:00 Verified
parent b5c896b77b
commit 16591f3560
5 changed files with 51 additions and 16 deletions
@@ -14,7 +14,13 @@ from ..shared.names import connection_id_to_resource_path
class ResourceLinkRewritingTool(Tool):
"""Delegate tool execution while rewriting returned resource-link URIs."""
"""Delegate execution while compensating for one FastMCP proxy gap.
FastMCP already rewrites resources listed through namespace transforms, but
proxied tools can also return typed `ResourceLink` content blocks. Current
FastMCP does not rewrite those result payloads for us, so this wrapper keeps
the public tool schema and changes only the returned resource-link URIs.
"""
model_config = ConfigDict(extra="allow", arbitrary_types_allowed=True)
@@ -50,7 +56,12 @@ class ResourceLinkRewritingTool(Tool):
class ResourceLinkNamespace(Transform):
"""Rewrite resource links returned by tools into one namespace."""
"""Mirror namespace URI projection inside proxied tool results.
This is a local stand-in for the result-transform behavior a fully
transparent FastMCP proxy would ideally provide itself. If upstream gains a
general result rewrite hook, this class should become deletable.
"""
def __init__(self, prefix: str) -> None:
self._prefix = connection_id_to_resource_path(prefix)
+5 -1
View File
@@ -26,7 +26,11 @@ def rewrite_call_tool_result_resource_links(
result: mcp_types.CallToolResult,
rewrite_uri: ResourceUriRewriter,
) -> mcp_types.CallToolResult:
"""Return a copy of a tool result with ResourceLink content URIs rewritten."""
"""Return a copy of a tool result with ResourceLink content URIs rewritten.
This pure helper expresses the same missing proxy behavior as
`ResourceLinkNamespace` without depending on FastMCP wrapper classes.
"""
return result.model_copy(
update={
"content": [