Skip to content

Conversation

@localconst
Copy link
Contributor

@localconst localconst commented Oct 16, 2025

  • Added read-only tool hint annotations for each tool
  • Added --read-only CLI flag to filter write tools
  • Added isReadOnly mode param for tool register functions
  • Added logic to remove registered tools where readOnlyHint == true & read-only mode enabled
  • Added mode description to readme
  • Added & updated tests

GitHub issue number

#571

Associated Risks

  • Maybe readOnlyHint annotation is incorrectly placed in some tools
  • If readOnlyHint Annotation omitted for tool, by default it's considered as false (write)

PR Checklist

  • I have read the contribution guidelines
  • I have read the code of conduct guidelines
  • Title of the pull request is clear and informative.
  • 👌 Code hygiene
  • 🔭 Telemetry added, updated, or N/A
  • 📄 Documentation added, updated, or N/A
  • 🛡️ Automated tests added, or N/A

🧪 How did you test it?

  • Register AzDO MCP server in mcp.json with --read-only flag in arguments
  • See 47 tools instead of 73

@localconst localconst requested a review from a team as a code owner October 16, 2025 22:41
@localconst
Copy link
Contributor Author

For review, it's recommended to enable the "Hide whitespace" mode :)

image

@localconst
Copy link
Contributor Author

@microsoft-github-policy-service agree

Comment on lines +149 to +155
if (isReadOnlyMode) {
for (const tool of registeredTools) {
if (!tool.annotations?.readOnlyHint) {
tool.remove();
}
}
);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find a better way to do it without making too many changes :(

@localconst
Copy link
Contributor Author

Read-only tools (47):

  • advsec_get_alerts
  • advsec_get_alert_details
  • core_list_project_teams
  • core_list_projects
  • core_get_identity_ids
  • pipelines_get_build_definitions
  • pipelines_get_build_definition_revisions
  • pipelines_get_builds
  • pipelines_get_build_log
  • pipelines_get_build_log_by_id
  • pipelines_get_build_changes
  • pipelines_get_run
  • pipelines_list_runs
  • pipelines_get_build_status
  • repo_list_repos_by_project
  • repo_list_pull_requests_by_repo_or_project
  • repo_list_pull_request_threads
  • repo_list_pull_request_thread_comments
  • repo_list_branches_by_repo
  • repo_list_my_branches_by_repo
  • repo_get_repo_by_name_or_id
  • repo_get_branch_by_name
  • repo_get_pull_request_by_id
  • repo_search_commits
  • repo_list_pull_requests_by_commits
  • search_code
  • search_wiki
  • search_workitem
  • testplan_list_test_plans
  • testplan_list_test_cases
  • testplan_show_test_results_from_build_id
  • wiki_list_wikis
  • wiki_get_wiki
  • wiki_list_pages
  • wiki_get_page
  • wiki_get_page_content
  • work_list_team_iterations
  • wit_list_backlogs
  • wit_list_backlog_work_items
  • wit_my_work_items
  • wit_get_work_items_batch_by_ids
  • wit_get_work_item
  • wit_list_work_item_comments
  • wit_get_work_items_for_iteration
  • wit_get_work_item_type
  • wit_get_query
  • wit_get_query_results_by_id

add/update/delete tools (26):

  • pipelines_run_pipeline
  • pipelines_update_build_stage
  • repo_create_pull_request
  • repo_create_branch
  • repo_update_pull_request
  • repo_update_pull_request_reviewers
  • repo_reply_to_comment
  • repo_create_pull_request_thread
  • repo_resolve_comment
  • testplan_create_test_plan
  • testplan_create_test_suite
  • testplan_add_test_cases_to_suite
  • testplan_create_test_case
  • testplan_update_test_case_steps
  • wiki_create_or_update_page
  • work_create_iterations
  • work_assign_iterations
  • wit_add_work_item_comment
  • wit_add_child_work_items
  • wit_link_work_item_to_pull_request
  • wit_update_work_item
  • wit_create_work_item
  • wit_update_work_items_batch
  • wit_work_items_link
  • wit_work_item_unlink
  • wit_add_artifact_link

@danhellem danhellem linked an issue Oct 17, 2025 that may be closed by this pull request
Copy link
Contributor

@polatengin polatengin left a comment

Choose a reason for hiding this comment

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

I like it 👍

Copy link
Collaborator

@Novaes Novaes left a comment

Choose a reason for hiding this comment

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

Pausing to review and see if we can simplify a few things—there are quite a lot of changes. Feel free to reach out early next week if it hasn’t moved forward.

@localconst
Copy link
Contributor Author

@Novaes
If the concern is mostly the size of PR diff, I believe we can split it into 2 PRs:

  1. Adding annotations
  2. Adding --read-only flag

If you in general don't agree with some solution parts, please let me know

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.

Read-only tools annotations & mode

3 participants