We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/harry-cysic/GhidraMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
GetCurrentAddress.java•1.45 KiB
package com.lauriewired.handlers.get;
import com.lauriewired.handlers.Handler;
import com.sun.net.httpserver.HttpExchange;
import ghidra.app.services.CodeViewerService;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.util.ProgramLocation;
import java.io.IOException;
import static com.lauriewired.util.ParseUtils.sendResponse;
/**
* Handler to get the current address from the CodeViewerService
*/
public final class GetCurrentAddress extends Handler {
/**
* Constructor for GetCurrentAddress handler
*
* @param tool PluginTool instance to access Ghidra services
*/
public GetCurrentAddress(PluginTool tool) {
super(tool, "/get_current_address");
}
/**
* Handle HTTP request to get current address
*
* @param exchange HttpExchange instance containing request and response
* @throws IOException if an I/O error occurs
*/
@Override
public void handle(HttpExchange exchange) throws IOException {
sendResponse(exchange, getCurrentAddress());
}
/**
* Retrieves the current address from the CodeViewerService
*
* @return String representation of the current address or an error message
*/
private String getCurrentAddress() {
CodeViewerService service = tool.getService(CodeViewerService.class);
if (service == null)
return "Code viewer service not available";
ProgramLocation location = service.getCurrentLocation();
return (location != null) ? location.getAddress().toString() : "No current location";
}
}