Skip to content

Remove unused fields from list accounts mcp tool #104

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

Merged
merged 1 commit into from
Apr 30, 2025

Conversation

G4brym
Copy link
Collaborator

@G4brym G4brym commented Apr 30, 2025

Users with a lot of accounts are wasting a lot of llm tokens on unused information, this pr makes sure only required (id + name) fields are returned to the LLM

@@ -20,6 +20,13 @@ export function registerAccountTools(agent: CloudflareMcpAgent) {
if (!b.created_on) return -1
return new Date(b.created_on).getTime() - new Date(a.created_on).getTime()
})
// Remove fields not needed by the LLM
.map((account) => {
Copy link
Member

@Maximo-Guk Maximo-Guk Apr 30, 2025

Choose a reason for hiding this comment

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

I've personally found it kinda useful for account list tool to display created_on dates in some chats. Maybe it makes sense to do this limiting, only once we've returned > 10 accounts or some other reasonable number?

Also perhaps we can inform the LLM that the output here is sorted, so it also has that context

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe we could introduce pagination on this tool, and keep the created_on property

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Maximo-Guk i've added back the created_on property, to all accounts
So this pr still cleans up a lot of unused properties, and keeps the created_on field, then in the future we can introduce pagination if needed

@G4brym G4brym force-pushed the improve-list-accounts-mcp-tool branch from eafce4d to 1ace983 Compare April 30, 2025 14:42
@Maximo-Guk Maximo-Guk merged commit c63cfab into cloudflare:main Apr 30, 2025
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.

3 participants