adv_get_version
Retrieve version details from the Adversary MCP Server, enabling developers to monitor and verify system information for enhanced security and compatibility during software development.
Instructions
Get version information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function for the 'adv_get_version' tool. It imports get_version from the package __init__, calls it to retrieve the version, constructs a JSON response with version info, and returns it as TextContent. Catches exceptions and raises CleanAdversaryToolError.async def _handle_get_version( self, name: str, arguments: dict ) -> list[types.TextContent]: """Get server version information.""" try: from adversary_mcp_server import get_version version_info = { "version": get_version(), "server_type": "mcp", "domain_layer": "enabled", } return [ types.TextContent(type="text", text=json.dumps(version_info, indent=2)) ] except Exception as e: logger.error(f"Version check failed: {e}") raise CleanAdversaryToolError(f"Version check failed: {str(e)}")
- src/adversary_mcp_server/application/mcp_server.py:117-138 (registration)The tool dispatcher registered with @self.server.call_tool() that routes calls to 'adv_get_version' to the _handle_get_version handler.@self.server.call_tool() async def tool_dispatcher( name: str, arguments: dict ) -> list[types.TextContent]: """Dispatch MCP tool calls to the appropriate handler.""" if name == "adv_scan_file": return await self._handle_scan_file(name, arguments) elif name == "adv_scan_folder": return await self._handle_scan_folder(name, arguments) elif name == "adv_scan_code": return await self._handle_scan_code(name, arguments) elif name == "adv_get_status": return await self._handle_get_status(name, arguments) elif name == "adv_get_version": return await self._handle_get_version(name, arguments) elif name == "adv_mark_false_positive": return await self._handle_mark_false_positive(name, arguments) elif name == "adv_unmark_false_positive": return await self._handle_unmark_false_positive(name, arguments) else: raise ValueError(f"Unknown tool: {name}")
- The Tool schema definition for 'adv_get_version' returned by get_tools(), which is used by the list_tools() handler. It defines no input properties as the tool takes no arguments.Tool( name="adv_get_version", description="Get server version information", inputSchema={"type": "object", "properties": {}}, ),
- Helper function get_version() called by the handler to retrieve the package version. It uses importlib.metadata.version, falls back to parsing pyproject.toml, or uses DEFAULT_VERSION.def get_version() -> str: """Get the current version of the adversary-mcp-server package.""" try: return version("adversary-mcp-server") except Exception: # Fallback - read from pyproject.toml using standard library try: return _read_version_from_pyproject() except Exception: # Final fallback to constant if all methods fail return DEFAULT_VERSION