docs for client and for fastmcp patches
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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": [
|
||||
|
||||
Reference in New Issue
Block a user