Class: BioRuby::MCP::Server::KEGGEnzymeTool
- Inherits:
-
MCP::Tool
- Object
- MCP::Tool
- BioRuby::MCP::Server::KEGGEnzymeTool
- Defined in:
- lib/bioruby/mcp/server/kegg_tools.rb
Overview
KEGG enzyme information tool
Constant Summary collapse
- KEGG_REST_BASE =
'http://rest.kegg.jp'
Class Method Summary collapse
Class Method Details
.call(enzyme_id:, server_context: nil) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/bioruby/mcp/server/kegg_tools.rb', line 166 def call(enzyme_id:, server_context: nil) # Clean up enzyme ID if needed enzyme_id = enzyme_id.gsub(/^(ec:|enzyme:)/, '') # Get enzyme entry from KEGG REST API enzyme_data = kegg_get_entry(enzyme_id) if enzyme_data.nil? || enzyme_data.empty? return ::MCP::Tool::Response.new([{ type: 'text', text: "Enzyme not found: #{enzyme_id}" }]) end # Parse the enzyme data using BioRuby enzyme = Bio::KEGG::ENZYME.new(enzyme_data) ::MCP::Tool::Response.new([{ type: 'text', text: "KEGG Enzyme: #{enzyme_id}\n" \ "Name: #{enzyme.name}\n" \ "Class: #{enzyme.enzyme_class}\n" \ "Reaction: #{enzyme.reaction}\n" \ "Substrate: #{enzyme.substrate}\n" \ "Product: #{enzyme.product}\n" \ "Comment: #{enzyme.comment}" }]) rescue => e ::MCP::Tool::Response.new([{ type: 'text', text: "Error retrieving enzyme info: #{e.message}" }]) end |