analyze_file
Submit files for security analysis to detect potential threats using Kaspersky's OpenTIP API. This tool provides basic file scanning to identify malicious content and security risks.
Instructions
Submit a file for basic analysis using the OpenTIP API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | ||
| full_file_path | Yes |
Input Schema (JSON Schema)
{
"properties": {
"filename": {
"title": "Filename",
"type": "string"
},
"full_file_path": {
"title": "Full File Path",
"type": "string"
}
},
"required": [
"filename",
"full_file_path"
],
"type": "object"
}
Implementation Reference
- opentip-mcp/opentip.py:192-199 (registration)Registers the analyze_file tool with the FastMCP server using the @mcp.tool decorator, including metadata like description and ToolAnnotations.@mcp.tool( description="Submit a file for basic analysis using the OpenTIP API.", annotations=ToolAnnotations( title="Analyze a file by uploading it", readOnlyHint=False, openWorldHint=True, ), )
- opentip-mcp/opentip.py:200-222 (handler)The core handler function for the analyze_file tool. It reads the specified file, prepares the request with filename param and octet-stream content, and calls opentip_request to POST to the scan/file endpoint.async def analyze_file(filename: str, full_file_path: str) -> dict[str, Any] | None: """Submit a file for basic analysis using the OpenTIP API. Args: filename: The name of the file to analyze. full_file_path: The full path to the file on the local system. """ params = {"filename": filename} headers = { "Content-Type": "application/octet-stream", } try: with open(full_file_path, "rb") as f: file_data = f.read() return await opentip_request( endpoint=Endpoints.analyze_file, request_type="post", params=params, content=file_data, headers=headers, ) except Exception as e: # noqa return {"result": "error", "error_message": str(e)}
- opentip-mcp/opentip.py:49-49 (helper)Defines the API endpoint string 'scan/file' for the analyze_file tool within the Endpoints enum.analyze_file = "scan/file"
- opentip-mcp/opentip.py:200-206 (schema)Function signature and docstring defining the input schema (filename: str, full_file_path: str) and output (dict[str, Any] | None).async def analyze_file(filename: str, full_file_path: str) -> dict[str, Any] | None: """Submit a file for basic analysis using the OpenTIP API. Args: filename: The name of the file to analyze. full_file_path: The full path to the file on the local system. """