Skip to content

tsp-client update #41853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

tsp-client update #41853

wants to merge 2 commits into from

Conversation

l0lawrence
Copy link
Member

No description provided.

@l0lawrence l0lawrence marked this pull request as ready for review July 1, 2025 22:28
@Copilot Copilot AI review requested due to automatic review settings July 1, 2025 22:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for a new update command in the MCP tool and relaxes the Python version requirement.

  • Broadens requires-python to allow any 3.10+ interpreter
  • Introduces an update_tool function to run a TypeSpec update command
  • Provides exception handling for the new update path

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
eng/tools/mcp/azure-sdk-python-mcp/pyproject.toml Changed Python requirement from ==3.10.* to >=3.10
eng/tools/mcp/azure-sdk-python-mcp/main.py Added update_tool decorated with @mcp.tool("update")
Comments suppressed due to low confidence (1)

eng/tools/mcp/azure-sdk-python-mcp/main.py:253

  • No tests cover the new update command. Add unit tests for update_tool to verify successful command invocation and proper error handling.
@mcp.tool("update")

Comment on lines +268 to +269
return run_command(["update"], cwd=package_path, is_typespec=True,
typespec_args={"commit": commit_hash})
Copy link
Preview

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error-handling path returns a dict with a message key, but the success path (from run_command) omits this field, resulting in an inconsistent schema. Consider normalizing the response to always include the same keys (e.g., add message or rename fields consistently).

Suggested change
return run_command(["update"], cwd=package_path, is_typespec=True,
typespec_args={"commit": commit_hash})
result = run_command(["update"], cwd=package_path, is_typespec=True,
typespec_args={"commit": commit_hash})
result["message"] = "Operation completed successfully"
return result

Copilot uses AI. Check for mistakes.


@mcp.tool("update")
def update_tool(commit_hash: str, package_path:str) -> Dict[str, Any]:
"""Initializes and subsequently generates a typespec client library directory from a local azure-rest-api-specs repo.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
"""Initializes and subsequently generates a typespec client library directory from a local azure-rest-api-specs repo.
"""Updates a client library from a local azure-rest-api-specs repo.

def update_tool(commit_hash: str, package_path:str) -> Dict[str, Any]:
"""Initializes and subsequently generates a typespec client library directory from a local azure-rest-api-specs repo.

This command is used to update a client library to a specific commit hash in the azure-rest-api-specs repository.
Copy link
Member

@catalinaperalta catalinaperalta Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of contradicting the previous description. Are we updating based on a local spec or a specific commit hash in the repo? It's fine (and probably ideal) if this tool can do both but we should clarify what the purpose of this tool is

This command is used to update a client library to a specific commit hash in the azure-rest-api-specs repository.

Args:
commit_hash: The commit hash to update to.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the local spec repo path is also supported then this should be optional


Args:
commit_hash: The commit hash to update to.
package_path: The path to the directory of the tsp-location.yaml (i.e. ./azure-sdk-for-python/sdk/eventgrid/azure-eventgrid).
Copy link
Member

@catalinaperalta catalinaperalta Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be optional. What if someone is asking the agent to update their client library from the same client library directory? Maybe we should check if tsp-location.yaml is in the same directory first, then if it isnt we can ask for the package path, this will make it more robust against different scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants