-
Notifications
You must be signed in to change notification settings - Fork 5
Feat/mcp/new tools #57
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
Conversation
| pub entity: T, | ||
| } | ||
|
|
||
| const EFFECTIVE_SEARCH_RATIO: f64 = 100000.0; // Adjust this ratio based on your needs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse the same EFFECTIVE_SEARCH_RATIO as the one from grc20-core/src/mapping/entity/semantic_search.rs so as to keep both in sync.
Suggestion: move it to grc20-core/src/mapping/mod.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query seems very similar to the SemanticSearchQuery defined in grc20-core/src/mapping/entity/semantic_search.rs with the only difference being the threshold. Is that correct or am I missing something?
If they are the same except for threshold, then just add threshold as an optional arg to SemanticSearchQuery with a default of 0.0 (to not filter anything) and use that query instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main difference is in the filter becoming a Vec. It allows to chain Entity filters and give them an order in the query which is needed for the traversal.
| { | ||
| "attribute_name": "Name", | ||
| "attribute_value": "Works at", | ||
| "entity_id": "U1uCAzXsRSTP4vFwo1JwJG" | ||
| }, | ||
| { | ||
| "attribute_name": "Is type property", | ||
| "attribute_value": "0", | ||
| "entity_id": "U1uCAzXsRSTP4vFwo1JwJG" | ||
| }, | ||
| { | ||
| "attribute_name": "Name", | ||
| "attribute_value": "Works at", | ||
| "entity_id": "U1uCAzXsRSTP4vFwo1JwJG" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate triple in the example, is that on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It comes from the name being declared in more than one space. Will be handled eventually with space handling.
| { | ||
| "attribute_name": "Is type property", | ||
| "attribute_value": "0", | ||
| "entity_id": "U1uCAzXsRSTP4vFwo1JwJG" | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is "Is type property"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id: T2TRBTBe5NS8vR94PLhzce
It is an Entity of type ATTRIBUTE that contains a checkbox and the name is "Is type property"
Basically I think it is an artifact of the first few relations in the data
| @@ -0,0 +1,25 @@ | |||
| This request allows you to search by name for a basic Relation of the Knowledge Graph(KG) like Owners or Authors. This will give back the | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description looks incomplete. Also, why "Relation" when the tool is called "search_properties"?
| @@ -0,0 +1,123 @@ | |||
| This request allows you to get the detailled information about an Entity with it's ID. You will get the name, description, other attributes, inbound relations and outbound relations of the Entity. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "detailled"
| #[derive(Clone, Debug, Default, PartialEq)] | ||
| pub struct Rename { | ||
| name_pair: NamePair, | ||
| params: HashMap<String, neo4rs::BoltType>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are params ever used? If not, then remove it!
| self | ||
| } | ||
|
|
||
| pub fn r#rename(mut self, rename: impl Into<Rename>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to prefix the method name with r# in this case! r# is only useful where the name of the method (or variable) is a reserved keyword (e.g.: r#struct, r#type, r#where, etc.)
| /// Filter used to: | ||
| /// - Traverse to inbound or outbound relation | ||
| #[derive(Clone, Debug, Default)] | ||
| pub struct TraverseRelationFilter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to TraverseRelationSubquery since it's not strictly a "filter", but also changes the nature of the returned data.
In general, subqueries that end in "Filter" (e.g.: "TypeFilter") imply that they do not change the nature of the returned data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI to load the tool description you need to use include_str! in the #[tool] macro, e.g.:
#[tool(description = include_str!("../resources/search_type_description.md"))]
async fn search_types(
&self,
#[tool(param)]
#[schemars(description = "The query string to search for types")]
query: String,
) -> Result<CallToolResult, McpError> {...}
Add new tools for MCP server and update existing ones
Modified:
They now all use triples in their search for future filters to be applied, standardize and accelerate search
Added:
To find a space based on it's name or description
Added:
Similar to search entity with the traversals but uses names of relation instead of id of relation. Also based on the SearchTraversalInputFilter
Added: