@@ -128,7 +128,7 @@ def run_typespec_cli_command(command: str, args: Dict[str, Any], root_dir: Optio
128
128
129
129
# Register tools for each TypeSpec client generator CLI command
130
130
@mcp .tool ("init" )
131
- def init_tool (tsp_config_url : str , root_dir : Optional [ str ] = None ) -> Dict [str , Any ]:
131
+ def init_tool (tsp_config_url : str ) -> Dict [str , Any ]:
132
132
"""Initialize a typespec client library directory given the url.
133
133
134
134
Args:
@@ -146,20 +146,18 @@ def init_tool(tsp_config_url: str, root_dir: Optional[str] = None) -> Dict[str,
146
146
args ["tsp-config" ] = updated_url
147
147
148
148
# If root_dir is not provided, use the repository root
149
- if root_dir is None :
150
- root_dir = os .path .abspath (os .path .join (os .path .dirname (__file__ ), "../.." ))
151
- logger .info (f"No root_dir provided, using repository root: { root_dir } " )
149
+ root_dir = os .path .abspath (os .path .join (os .path .dirname (__file__ ), "../.." ))
150
+ logger .info (f"No root_dir provided, using repository root: { root_dir } " )
152
151
153
152
return run_typespec_cli_command ("init" , args , root_dir = root_dir )
154
153
155
154
@mcp .tool ("init_local" )
156
- def init_local_tool (tsp_config_path : str , root_dir : Optional [ str ] = None ) -> Dict [str , Any ]:
155
+ def init_local_tool (tsp_config_path : str ) -> Dict [str , Any ]:
157
156
"""Initialize a typespec client library directory from a local azure-rest-api-specs repo.
158
157
159
158
Args:
160
159
tsp_config_path: The path to the local tspconfig.yaml file.
161
- root_dir: The root directory where the client library will be generated.
162
-
160
+
163
161
Returns:
164
162
A dictionary containing the result of the command.
165
163
"""
@@ -168,9 +166,8 @@ def init_local_tool(tsp_config_path: str, root_dir: Optional[str] = None) -> Dic
168
166
args ["tsp-config" ] = tsp_config_path
169
167
170
168
# If root_dir is not provided, use the repository root
171
- if root_dir is None :
172
- root_dir = os .path .abspath (os .path .join (os .path .dirname (__file__ ), "../.." ))
173
- logger .info (f"No root_dir provided, using repository root: { root_dir } " )
169
+ root_dir = os .path .abspath (os .path .join (os .path .dirname (__file__ ), "../../.." ))
170
+ logger .info (f"No root_dir provided, using repository root: { root_dir } " )
174
171
175
172
return run_typespec_cli_command ("init" , args , root_dir = root_dir )
176
173
0 commit comments