List OCSF versions
ocsf_get_versionsLists available OCSF schema versions to help users select appropriate versions for cybersecurity data mapping and understand schema evolution.
Instructions
List all bundled OCSF schema versions.
Use this tool to:
See which OCSF schema versions are available
Choose a specific version for your mapping work
Understand schema evolution across versions
Typically you'll want to use ocsf_get_latest_version instead to get
the most recent stable version automatically.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main asynchronous handler function for the 'ocsf_get_versions' tool. It calls the helper to list versions and formats the output as both markdown list and structured JSON.
async def ocsf_get_versions() -> ToolResult: """List all bundled OCSF schema versions. Use this tool to: - See which OCSF schema versions are available - Choose a specific version for your mapping work - Understand schema evolution across versions Typically you'll want to use `ocsf_get_latest_version` instead to get the most recent stable version automatically.""" versions = list_ocsf_versions() return ToolResult( content="\n".join([f"- {v}" for v in versions]), # Markdown list structured_content={"versions": versions}, # JSON array ) - src/tenzir_mcp/tools/ocsf/ocsf_get_versions.py:33-42 (registration)The @mcp.tool decorator that registers the tool with name 'ocsf_get_versions', tags, and annotations for MCP server integration.
@mcp.tool( name="ocsf_get_versions", tags={"ocsf"}, annotations={ "title": "List OCSF versions", "readOnlyHint": True, "idempotentHint": True, "openWorldHint": False, }, ) - Helper function that scans the bundled OCSF data directory for JSON schema files, extracts version numbers from filenames, sorts them, and returns the list of available versions.
def list_ocsf_versions() -> list[str]: """ Get all available OCSF schema versions. """ # Get the OCSF data directory ocsf_files = files("tenzir_mcp.data.ocsf") # Extract version numbers from JSON filenames versions = [] for file_path in ocsf_files.iterdir(): if file_path.name.endswith(".json"): # Remove .json extension to get version version = file_path.name[:-5] versions.append(version) # Sort versions (simple string sort works for semantic versions) versions.sort() return versions