Skip to content

RHDHPAI-1037: MCP tool to query catalog entities #2

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 5 commits into from
Aug 19, 2025

Conversation

johnmcollier
Copy link

Assisted-by: claude-4-sonnet

Hey, I just made a Pull Request!

This PR adds a basic MCP tool using the Backstage MCP plugin framework to enable basic queries against the Backstage catalog:

  1. Listing entities present in the Backstage catalog
  2. Filtering catalog entities based on Kind
  3. Filtering catalog entities based on type

I've opted to leave text based querying to the MCP client invoking the tool.

In addition to the entity name, the tool also returns the kind, type, description and tags for the entity. https://issues.redhat.com/browse/RHDHPAI-1038 will handle more detailed metadata retrieval than what's returned here.

I've also prepared a very basic EVAL.md file at the top of the workspace that provides comparison in tool invocations across different models (currently just claude-4-sonnet and llama3.1:8b).

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • [ x Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Assisted-by: claude-4-sonnet
Signed-off-by: John Collier <[email protected]>
@johnmcollier
Copy link
Author

CC @gabemontero

Copy link

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

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

just some minor comments .... yeah the backstage actions framework does provide a nice plug point for registering tools into an mcp server @johnmcollier

List all Backstage entities such as Components, Systems, Resources, APIs, Locations, Users, and Groups.
Results are returned in JSON array format, where each entry in the JSON array has the following fields: 'name', 'description','uid', and 'type'.

This tool searches through the software catalog to find components the entities. It supports filtering by entity properties and

Choose a reason for hiding this comment

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

to find components the entities does not parse as grammatically correct to me @johnmcollier but I'm not sure where you were going, so I couldn't just suggest the correction

Choose a reason for hiding this comment

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

also down below you got some more precise restrictions on what you can filter on ... i.e. the comment below that starts with Validate that type is only used with kind -- we could just allow 'type' to be specified without 'kind' but given types...

Copy link
Author

Choose a reason for hiding this comment

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

Oops - it should be fixed now, I think some errant copy/pasting messed up the original phrasing.

I've also updated the description to denote the specific requirements on filtering by type

}
]
}
`,

Choose a reason for hiding this comment

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

and "end of description" comment might be helpful ... it took me a couple to sort out that schema was the next field in the parameter passed to the actions registry

Copy link
Author

Choose a reason for hiding this comment

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

Yup, good idea. Updated

Choose a reason for hiding this comment

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

oh sorry @johnmcollier in case it was not clear ... .I was thinking a typescript comment after the backtick and before the comma

I don't think you want to include <End of Description> in the actual description string

make sense?

Copy link
Author

Choose a reason for hiding this comment

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

🤦 Yes, that makes more sense haha. Thanks @gabemontero I've pushed an update that switches it to a comment

johnmcollier and others added 3 commits August 18, 2025 11:47
@johnmcollier
Copy link
Author

@gabemontero Thanks for the review! Comments have been addressed in a new commit

@gabemontero
Copy link

@gabemontero Thanks for the review! Comments have been addressed in a new commit

just one minor f/up on the end of description comment I suggested adding @johnmcollier

Signed-off-by: John Collier <[email protected]>
@johnmcollier
Copy link
Author

@gabemontero Thanks Gabe, pushed an update to fix the comment

Copy link

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

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

@johnmcollier johnmcollier merged commit 137fbdd into main Aug 19, 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.

2 participants