Jeremiah Lowin commited on
Commit
ef08a5c
·
1 Parent(s): d8b680d

add name tests

Browse files
Files changed (1) hide show
  1. src/fastmcp/server/openapi.py +5 -2
src/fastmcp/server/openapi.py CHANGED
@@ -38,7 +38,10 @@ HttpMethod = Literal["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"]
38
 
39
 
40
  def _slugify(text: str) -> str:
41
- """Convert text to a URL-friendly slug format."""
 
 
 
42
  if not text:
43
  return ""
44
 
@@ -807,7 +810,7 @@ class FastMCPOpenAPI(FastMCP):
807
  if route.operation_id in self._mcp_names:
808
  name = self._mcp_names[route.operation_id]
809
  else:
810
- # If there's a double underscore, use the first part
811
  name = route.operation_id.split("__")[0]
812
  else:
813
  name = route.summary or f"{route.method}_{route.path}"
 
38
 
39
 
40
  def _slugify(text: str) -> str:
41
+ """
42
+ Convert text to a URL-friendly slug format that only contains lowercase
43
+ letters, uppercase letters, numbers, and underscores.
44
+ """
45
  if not text:
46
  return ""
47
 
 
810
  if route.operation_id in self._mcp_names:
811
  name = self._mcp_names[route.operation_id]
812
  else:
813
+ # If there's a double underscore in the operationId, use the first part
814
  name = route.operation_id.split("__")[0]
815
  else:
816
  name = route.summary or f"{route.method}_{route.path}"