ols4
ols4 copied to clipboard
Add detailed instructions to MCP tool descriptions
Add Detailed Instructions to MCP Tools ✅
- [x] Review current MCP tool descriptions in the codebase
- [x] Enhance McpSearchService tool descriptions with detailed instructions
- [x] Improve 'search' tool description - added comprehensive details about parameters, return values, and usage
- [x] Improve 'fetch' tool description - updated with exact field types and structure from code analysis
- [x] Enhance McpClassService tool descriptions with detailed instructions
- [x] Improve 'searchClasses' tool description - added examples, parameter details, and pagination info
- [x] Improve 'getAncestors' tool description - explained hierarchical relationships and use cases
- [x] Improve 'getDescendants' tool description - explained subtypes and practical applications
- [x] Enhance McpOntologyService tool descriptions with detailed instructions
- [x] Improve 'listOntologies' tool description - added comprehensive information about ontologies and examples
- [x] Build and validate changes - Maven build successful
- [x] Run security checks - No vulnerabilities detected
- [x] Address feedback - Updated fetch description with exact field types from code
Summary
Enhanced the MCP (Model Context Protocol) tool descriptions in the OLS4 backend with detailed, comprehensive instructions. All 6 MCP tools now include:
Enhanced Tools:
- search - Full-text search across all ontologies with clear parameter and return format documentation
- fetch - Retrieve detailed term information with exact field types (String vs List<String>), structure of metadata object including McpEntityReference fields
- searchClasses - Search ontology classes with filtering options and pagination
- getAncestors - Get parent classes in hierarchy with practical use cases
- getDescendants - Get child classes with subtypes examples
- listOntologies - List all available ontologies with common examples
Improvements Made:
- Added detailed parameter descriptions with examples
- Documented return value structures accurately based on actual implementation code
- Specified exact field types (String, List<String>, List<Object>) from McpFetchResult, McpClass, and McpEntityReference classes
- Included practical use cases and workflow guidance
- Added examples of common ontologies (GO, EFO, HP, MONDO, etc.)
- Explained relationships between tools (e.g., use 'search' then 'fetch')
- Clarified data formats and expected inputs
Files Modified:
backend/src/main/java/uk/ac/ebi/spot/ols/controller/mcp/McpSearchService.javabackend/src/main/java/uk/ac/ebi/spot/ols/controller/mcp/McpClassService.javabackend/src/main/java/uk/ac/ebi/spot/ols/controller/mcp/McpOntologyService.java
Validation: ✅ Maven build successful (1:38 min) ✅ CodeQL security check passed (0 vulnerabilities) ✅ No breaking changes to API contracts
Security Summary
No security vulnerabilities were introduced or discovered during the implementation. The changes are purely documentation enhancements to existing @Tool annotations.
Original prompt
This section details on the original issue you should resolve
<issue_title>Add detailed instructions to the MCP tools</issue_title> <issue_description></issue_description>
Comments on the Issue (you are @copilot in this section)
Fixes EBISPOT/ols4#1016
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.