Skip to content

Annotate search and list_accessible_customers as readOnlyHint#63

Merged
Raibaz merged 1 commit intogoogleads:mainfrom
ZLeventer:feat/readonly-hint-annotations
Apr 27, 2026
Merged

Annotate search and list_accessible_customers as readOnlyHint#63
Raibaz merged 1 commit intogoogleads:mainfrom
ZLeventer:feat/readonly-hint-annotations

Conversation

@ZLeventer
Copy link
Copy Markdown
Contributor

Summary

The search and list_accessible_customers tools only invoke read methods on the Google Ads API, but only get_resource_metadata was declaring ToolAnnotations(readOnlyHint=True). MCP clients surface this hint to users (and some hosts use it to gate tool calls), so all three tools should declare it consistently.

Changes

  • ads_mcp/tools/core.py: add ToolAnnotations(readOnlyHint=True) to list_accessible_customers.
  • ads_mcp/tools/search.py: register search via Tool.from_function(..., annotations=ToolAnnotations(readOnlyHint=True)) since mcp.add_tool does not accept annotations directly.
  • tests/smoke/golden_tools_list.json: refreshed via python -m tests.smoke.generate_golden so the smoke test still passes; only the two new annotations blocks change.

Test plan

  • python -m unittest discover --buffer -s tests -p "*_test.py" — 18/18 pass
  • black -l 80 --check ads_mcp tests — clean
  • Verified the regenerated golden diff is limited to the two added annotations blocks

The search and list_accessible_customers tools only call read methods
on the Google Ads API but were not annotated as read-only, while
get_resource_metadata already was. MCP clients use readOnlyHint to
inform users which tools have side effects, so all three should be
declared consistently.

Refresh the smoke test golden to include the new annotations.
@Raibaz Raibaz self-requested a review April 27, 2026 07:11
@Raibaz Raibaz merged commit cd17ff6 into googleads:main Apr 27, 2026
8 checks passed
@ZLeventer ZLeventer deleted the feat/readonly-hint-annotations branch April 28, 2026 02:37
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