Skip to content
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

Limit the data returned in list operations #27

Closed
wants to merge 1 commit into from

Conversation

csmarchbanks
Copy link
Contributor

When running list operations against large instances even the default limits were causing things like Cursor or Claude Desktop to bail as the conversation was too large. Using summary types for these calls instead allow them to return with reasonable limits.

When running list operations against large instances even the default
limits were causing things like Cursor or Claude Desktop to bail as the
conversation was too large. Using summary types for these calls instead
allow them to return with reasonable limits.
Comment on lines +9 to +27
async def list_datasources() -> List[Datasource]:
"""
List datasources in the Grafana instance.
"""
return await grafana_client.list_datasources()
datasources = await grafana_client.list_datasources()
resp = []
# Only push a subset of fields to save on space.
for ds in datasources:
resp.append(
{
"id": ds.id,
"uid": ds.uid,
"name": ds.name,
"type": ds.type,
"isDefault": ds.is_default,
}
)

return resp
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this type annotation is incorrect since we're returning dicts not datasource objects? Probably doesn't matter for now but mypy will probably complain if/when we add it.

Perhaps we could add a more minimal Datasource type instead though, since the model might be expecting to see all the fields if it's passed the schema of the Datasource type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that is on the list of things to fix before I mark this as ready to review.

@csmarchbanks
Copy link
Contributor Author

Supserseded by #30.

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