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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/mcp-common/src/tools/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ 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

return {
id: account.id,
name: account.name,
created_on: account.created_on,
}
})

return {
content: [
Expand Down