yihuang Copilot commited on
Commit
dccb245
·
unverified ·
1 Parent(s): fd9bcfe

Apply suggestions from code review

Browse files

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Files changed (1) hide show
  1. src/fastmcp/server/proxy.py +8 -0
src/fastmcp/server/proxy.py CHANGED
@@ -180,6 +180,8 @@ class FastMCPProxy(FastMCP):
180
  except McpError as e:
181
  if e.error.code == METHOD_NOT_FOUND:
182
  client_tools = []
 
 
183
  for tool in client_tools:
184
  tool_proxy = await ProxyTool.from_client(self.client, tool)
185
  tools[tool_proxy.name] = tool_proxy
@@ -195,6 +197,8 @@ class FastMCPProxy(FastMCP):
195
  except McpError as e:
196
  if e.error.code == METHOD_NOT_FOUND:
197
  client_resources = []
 
 
198
  for resource in client_resources:
199
  resource_proxy = await ProxyResource.from_client(self.client, resource)
200
  resources[str(resource_proxy.uri)] = resource_proxy
@@ -210,6 +214,8 @@ class FastMCPProxy(FastMCP):
210
  except McpError as e:
211
  if e.error.code == METHOD_NOT_FOUND:
212
  client_templates = []
 
 
213
  for template in client_templates:
214
  template_proxy = await ProxyTemplate.from_client(self.client, template)
215
  templates[template_proxy.uri_template] = template_proxy
@@ -225,6 +231,8 @@ class FastMCPProxy(FastMCP):
225
  except McpError as e:
226
  if e.error.code == METHOD_NOT_FOUND:
227
  client_prompts = []
 
 
228
  for prompt in client_prompts:
229
  prompt_proxy = await ProxyPrompt.from_client(self.client, prompt)
230
  prompts[prompt_proxy.name] = prompt_proxy
 
180
  except McpError as e:
181
  if e.error.code == METHOD_NOT_FOUND:
182
  client_tools = []
183
+ else:
184
+ raise e
185
  for tool in client_tools:
186
  tool_proxy = await ProxyTool.from_client(self.client, tool)
187
  tools[tool_proxy.name] = tool_proxy
 
197
  except McpError as e:
198
  if e.error.code == METHOD_NOT_FOUND:
199
  client_resources = []
200
+ else:
201
+ raise e
202
  for resource in client_resources:
203
  resource_proxy = await ProxyResource.from_client(self.client, resource)
204
  resources[str(resource_proxy.uri)] = resource_proxy
 
214
  except McpError as e:
215
  if e.error.code == METHOD_NOT_FOUND:
216
  client_templates = []
217
+ else:
218
+ raise e
219
  for template in client_templates:
220
  template_proxy = await ProxyTemplate.from_client(self.client, template)
221
  templates[template_proxy.uri_template] = template_proxy
 
231
  except McpError as e:
232
  if e.error.code == METHOD_NOT_FOUND:
233
  client_prompts = []
234
+ else:
235
+ raise e
236
  for prompt in client_prompts:
237
  prompt_proxy = await ProxyPrompt.from_client(self.client, prompt)
238
  prompts[prompt_proxy.name] = prompt_proxy