-
Notifications
You must be signed in to change notification settings - Fork 3
a2a structure agent #40
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
base: devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1130,6 +1130,45 @@ def inspect_structure( | |||||
| ) | ||||||
|
|
||||||
|
|
||||||
| ## ================================ | ||||||
| ## Tools for file transfer between local and remote structure agents | ||||||
| ## =============================== | ||||||
|
|
||||||
| import requests | ||||||
|
||||||
|
|
||||||
| @mcp.tool() | ||||||
| def get_remote_files(file_urls: list[str], local_save_path: str="downloads") -> list[dict]: | ||||||
| """ | ||||||
| Downloads files from the remote agent to local storage. | ||||||
| Args: | ||||||
| file_urls: List of full URLs of files to download from the remote agent. | ||||||
| local_save_path: Local directory path to save the downloaded files. | ||||||
| """ | ||||||
| os.makedirs(local_save_path, exist_ok=True) | ||||||
| results: list[dict] = [] | ||||||
| for file_url in file_urls: | ||||||
| # Extract filename from URL (the last part) | ||||||
| file_name = file_url.split('/')[-1] | ||||||
| local_file_path = os.path.join(local_save_path, file_name) | ||||||
|
Comment on lines
+1151
to
+1152
|
||||||
|
|
||||||
| # get the file contents from the remote URL | ||||||
| response = requests.get(file_url) | ||||||
|
||||||
| response = requests.get(file_url) | |
| response = requests.get(file_url, timeout=10) |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function lacks proper error handling around the file operations. If an error occurs during writing (e.g., disk full, permission denied), the function will raise an unhandled exception. The partial file might be left on disk, and subsequent URLs in the list won't be processed. Consider wrapping file operations in try-except blocks and handling errors gracefully.
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new get_remote_files function lacks test coverage. Given that the repository has test coverage for structure building functions in tests/test_structure_builder.py, this new file transfer functionality should also have tests covering successful downloads, error cases (network failures, invalid URLs, file write errors), and security scenarios (path traversal attempts).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded URL "http://localhost:8001" will not work in production environments or when the remote agent is deployed elsewhere. This should be configurable through environment variables or configuration files to support different deployment scenarios.