Skip to content

Add the get_resource_metadata tool and remove resource metadata from …#37

Merged
Raibaz merged 4 commits intomainfrom
optimize-search
Mar 24, 2026
Merged

Add the get_resource_metadata tool and remove resource metadata from …#37
Raibaz merged 4 commits intomainfrom
optimize-search

Conversation

@Raibaz
Copy link
Copy Markdown
Collaborator

@Raibaz Raibaz commented Mar 23, 2026

…the search tool description

Fixes #15.

This PR includes the following changes:

  • Add the get_resource_metadata tool to retrieve resource metadata using the GoogleAdsFieldService and its own test, get_resource_metadata_test
  • Remove resource metadata from gaql_resources.json and only keep the names of available resources
  • Change gaql_resources.json` to a .txt file since it now only has a flat list of resource names
  • Update the description of the search tool to clarify that resource metadata is to be retrieved with the get_resource_metadata tool
  • Update smoke tests to include get_resource_metadata

…the search tool description

Change-Id: I29ce75700465667873d43fdb434977eddba60de2

# The Google Ads Field Service supports LIKE operator natively.
# This filter ensures we only get rows that belong to the queried resource.
query = f"SELECT name, selectable, filterable, sortable WHERE name LIKE '{resource_name}.%'"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is the .% intentional? Is that a wildcard for the resource name?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is intentional, because it's a query to retrieve all fields inside a resource.

So for instance if resource_name is campaign, we want to retrieve campaign.resource_name, campaign.id, campaign.name etc.

Raibaz added 3 commits March 24, 2026 16:22
…etadata responses

Change-Id: Idc74b0c45e9f708cee0cb611f319e5478c9602fb
Change-Id: Icfdc37360a055396910704d432adab097fc557a0
Change-Id: Ifac88f8f20ea7daccc0717cd882251f8651ed91c
@Raibaz Raibaz merged commit b6c56b9 into main Mar 24, 2026
8 checks passed
@Raibaz Raibaz deleted the optimize-search branch March 24, 2026 17:28
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.

search tool description is excessively large (>300k chars), causing truncation errors in MCP clients

2 participants