Skip to content

Commit 3e7b7d4

Browse files
authored
tool change (#41098)
1 parent fd9e90f commit 3e7b7d4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tools/mcp/typespec-story/main.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def run_typespec_cli_command(command: str, args: Dict[str, Any], root_dir: Optio
128128

129129
# Register tools for each TypeSpec client generator CLI command
130130
@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]:
132132
"""Initialize a typespec client library directory given the url.
133133
134134
Args:
@@ -146,20 +146,18 @@ def init_tool(tsp_config_url: str, root_dir: Optional[str] = None) -> Dict[str,
146146
args["tsp-config"] = updated_url
147147

148148
# 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}")
152151

153152
return run_typespec_cli_command("init", args, root_dir=root_dir)
154153

155154
@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]:
157156
"""Initialize a typespec client library directory from a local azure-rest-api-specs repo.
158157
159158
Args:
160159
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+
163161
Returns:
164162
A dictionary containing the result of the command.
165163
"""
@@ -168,9 +166,8 @@ def init_local_tool(tsp_config_path: str, root_dir: Optional[str] = None) -> Dic
168166
args["tsp-config"] = tsp_config_path
169167

170168
# 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}")
174171

175172
return run_typespec_cli_command("init", args, root_dir=root_dir)
176173

0 commit comments

Comments
 (0)