Skip to content

Commit d2d8568

Browse files
committed
refactor: Rename SysQL tool and remove deprecated tools
1 parent 63edbad commit d2d8568

File tree

14 files changed

+34
-945
lines changed

14 files changed

+34
-945
lines changed

README.md

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# MCP Server
22

3-
| App Test | Helm Test |
4-
|------|---------|
5-
| [![App Test](https://github.com/sysdiglabs/sysdig-mcp-server/actions/workflows/publish.yaml/badge.svg?branch=main)](https://github.com/sysdiglabs/sysdig-mcp-server/actions/workflows/publish.yaml) | [![Helm Test](https://github.com/sysdiglabs/sysdig-mcp-server/actions/workflows/helm_test.yaml/badge.svg?branch=main)](https://github.com/sysdiglabs/sysdig-mcp-server/actions/workflows/helm_test.yaml) |
3+
| App Test |
4+
|------|
5+
| [![App Test](https://github.com/sysdiglabs/sysdig-mcp-server/actions/workflows/publish.yaml/badge.svg?branch=main)](https://github.com/sysdiglabs/sysdig-mcp-server/actions/workflows/publish.yaml) |
66

77
---
88

@@ -96,37 +96,11 @@ Get up and running with the Sysdig MCP Server quickly using our pre-built Docker
9696
</details>
9797

9898
<details>
99-
<summary><strong>Inventory</strong></summary>
99+
<summary><strong>Sysdig SysQL</strong></summary>
100100

101101
| Tool Name | Description | Sample Prompt |
102102
|-----------|-------------|----------------|
103-
| `list_resources` | List inventory resources using filters (e.g., platform or category) | "List all exposed IAM resources in AWS" |
104-
| `get_resource` | Get detailed information about an inventory resource by its hash | "Get inventory details for hash abc123" |
105-
106-
</details>
107-
108-
<details>
109-
<summary><strong>Vulnerability Management</strong></summary>
110-
111-
| Tool Name | Description | Sample Prompt |
112-
|-----------|-------------|----------------|
113-
| `list_runtime_vulnerabilities` | List runtime vulnerability scan results with filtering | "List running vulnerabilities in cluster1 sorted by severity" |
114-
| `list_accepted_risks` | List all accepted vulnerability risks | "Show me all accepted risks related to nginx containers" |
115-
| `get_accepted_risk` | Retrieve a specific accepted risk by ID | "Get details for accepted risk id abc123" |
116-
| `list_registry_scan_results` | List scan results for container registries | "List failed scans from harbor registry" |
117-
| `get_vulnerability_policy_by_id` | Get a specific vulnerability policy by ID | "Show policy ID 42" |
118-
| `list_vulnerability_policies` | List all vulnerability policies | "List all vulnerability policies for pipeline stage" |
119-
| `list_pipeline_scan_results` | List CI pipeline scan results | "Show me pipeline scans that failed for ubuntu images" |
120-
| `get_scan_result` | Retrieve detailed scan results by scan ID | "Get results for scan ID 456def" |
121-
122-
</details>
123-
124-
<details>
125-
<summary><strong>Sysdig Sage</strong></summary>
126-
127-
| Tool Name | Description | Sample Prompt |
128-
|-----------|-------------|----------------|
129-
| `sysdig_sysql_sage_query` | Generate and run a SysQL query using natural language | "List top 10 pods by memory usage in the last hour" |
103+
| `generate_and_run_sysql` | Generate and run a SysQL query using natural language | "List top 10 pods by memory usage in the last hour" |
130104

131105
</details>
132106

@@ -141,8 +115,6 @@ Get up and running with the Sysdig MCP Server quickly using our pre-built Docker
141115

142116
### Available Resources
143117

144-
- Sysdig Secure Vulnerability Management Overview:
145-
- VM documentation based on the following [url](https://docs.sysdig.com/en/sysdig-secure/vulnerability-management/)
146118
- Sysdig Filter Query Language Instructions:
147119
- Sysdig Filter Query Language for different API endpoint filters
148120

tests/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from utils.app_config import AppConfig
99
from unittest.mock import MagicMock, create_autospec, patch
1010
from fastmcp.server.context import Context
11-
from sysdig_client import SecureEventsApi, ApiClient, InventoryApi, VulnerabilityManagementApi
11+
from sysdig_client import SecureEventsApi, ApiClient
1212
from utils.sysdig.legacy_sysdig_api import LegacySysdigApi
1313
from fastmcp.server import FastMCP
1414

@@ -79,8 +79,6 @@ def mock_context() -> Context:
7979

8080
api_instances = {
8181
"secure_events": SecureEventsApi(ApiClient()),
82-
"vulnerability_management": VulnerabilityManagementApi(ApiClient()),
83-
"inventory": InventoryApi(ApiClient()),
8482
"legacy_sysdig_api": LegacySysdigApi(ApiClient()),
8583
}
8684
ctx.set_state("api_instances", api_instances)

tools/events_feed/tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def tool_get_event_process_tree(self, ctx: Context, event_id: str) -> dict:
213213
self.log.error(f"Exception when calling process tree API: {e}")
214214
raise ToolError(f"Failed to get process tree: {e}")
215215
except ToolError as e:
216-
self.log.error(f"Exception when calling Sysdig Sage API to get process tree: {e}")
216+
self.log.error(f"Exception when calling Sysdig API to get process tree: {e}")
217217
raise e
218218

219219
# Prompts
@@ -224,7 +224,7 @@ def investigate_event_prompt(self, severity: str, relative_time: str) -> PromptM
224224
severity (str): The severity level of the security event (e.g., "high", "medium", "low").
225225
relative_time (str): The time range for the events to investigate (e.g., "last 24 hours").
226226
Returns:
227-
PromptMessage: A message object containing the prompt for investigation.
227+
PromptMessage: An object containing the prompt for investigation.
228228
"""
229229
content = (
230230
f"Please investigate security events with severity '{severity}' of the last {relative_time}. "

tools/inventory/tool.py

Lines changed: 0 additions & 197 deletions
This file was deleted.

tools/sysdig_sage/__init__.py

Whitespace-only changes.
File renamed without changes.

tools/sysdig_sage/tool.py renamed to tools/sysql/tool.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
2-
Sysdig Sage Tool
3-
This tool provides functionality to interact with Sysdig Sage, allowing users to
2+
Sysdig SysQL Tool
3+
This tool provides functionality to interact with Sysdig, allowing users to
44
generate SysQL queries based on natural language questions and execute them against the Sysdig API.
55
"""
66

@@ -14,9 +14,9 @@
1414
from utils.query_helpers import create_standard_response
1515

1616

17-
class SageTools:
17+
class SysQLTools:
1818
"""
19-
A class to encapsulate the tools for interacting with Sysdig Sage.
19+
A class to encapsulate the tools for interacting with Sysdig SysQL.
2020
This class provides methods to generate SysQL queries based on natural
2121
language questions and execute them against the Sysdig API.
2222
"""
@@ -25,14 +25,14 @@ def __init__(self, app_config: AppConfig):
2525
self.app_config = app_config
2626
self.log = logging.getLogger(__name__)
2727

28-
async def tool_sage_to_sysql(self, ctx: Context, question: str) -> dict:
28+
async def tool_generate_and_run_sysql(self, ctx: Context, question: str) -> dict:
2929
"""
30-
Queries Sysdig Sage with a natural language question, retrieves a SysQL query,
30+
Queries Sysdig with a natural language question, retrieves a SysQL query,
3131
executes it against the Sysdig API, and returns the results.
3232
3333
Args:
3434
ctx (Context): A context object containing configuration information.
35-
question (str): A natural language question to send to Sage.
35+
question (str): A natural language question to send to Sysdig.
3636
3737
Returns:
3838
dict: A dictionary containing the results of the SysQL query execution and the query text.
@@ -41,9 +41,9 @@ async def tool_sage_to_sysql(self, ctx: Context, question: str) -> dict:
4141
ToolError: If the SysQL query generation or execution fails.
4242
4343
Examples:
44-
# tool_sage_to_sysql(question="Match Cloud Resource affected by Critical Vulnerability")
45-
# tool_sage_to_sysql(question="Match Kubernetes Workload affected by Critical Vulnerability")
46-
# tool_sage_to_sysql(question="Match AWS EC2 Instance that violates control 'EC2 - Instances should use IMDSv2'")
44+
# tool_generate_and_run_sysql(question="Match Cloud Resource affected by Critical Vulnerability")
45+
# tool_generate_and_run_sysql(question="Match Kubernetes Workload affected by Critical Vulnerability")
46+
# tool_generate_and_run_sysql(question="Match AWS EC2 Instance that violates control 'EC2 - Instances should use IMDSv2'")
4747
"""
4848
# 1) Generate SysQL query
4949
try:
@@ -56,14 +56,14 @@ async def tool_sage_to_sysql(self, ctx: Context, question: str) -> dict:
5656

5757
sysql_response = await legacy_api_client.generate_sysql_query(question)
5858
if sysql_response.status > 299:
59-
raise ToolError(f"Sysdig Sage returned an error: {sysql_response.status} - {sysql_response.data}")
59+
raise ToolError(f"Sysdig returned an error: {sysql_response.status} - {sysql_response.data}")
6060
except ToolError as e:
6161
self.log.error(f"Failed to generate SysQL query: {e}")
6262
raise e
6363
json_resp = sysql_response.json() if sysql_response.data else {}
6464
sysql_query: str = json_resp.get("text", "")
6565
if not sysql_query:
66-
return {"error": "Sysdig Sage did not return a query"}
66+
return {"error": "Sysdig did not return a query"}
6767

6868
# 2) Execute generated SysQL query
6969
try:

tools/vulnerability_management/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)