Skip to content

Commit 2ecf945

Browse files
committed
Update environment variable references from CODELOGIC_MV_NAME to CODELOGIC_WORKSPACE_NAME across multiple files, including README, test configurations, and handlers. Add .gitignore entry for impact analysis result files.
1 parent 1977847 commit 2ecf945

File tree

10 files changed

+36
-27
lines changed

10 files changed

+36
-27
lines changed

.cursor/rules/codelogic-rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ When implementing new MCP tools:
7979
- `CODELOGIC_SERVER_HOST`: CodeLogic server URL
8080
- `CODELOGIC_USERNAME`: Username for authentication
8181
- `CODELOGIC_PASSWORD`: Password for authentication
82-
- `CODELOGIC_MV_NAME`: Materialized view name
82+
- `CODELOGIC_WORKSPACE_NAME`: Workspace name
8383
- `CODELOGIC_DEBUG_MODE`: Enable debug logging
8484
- `CODELOGIC_TEST_MODE`: Used by test framework
8585

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ When implementing new MCP tools:
7979
- `CODELOGIC_SERVER_HOST`: CodeLogic server URL
8080
- `CODELOGIC_USERNAME`: Username for authentication
8181
- `CODELOGIC_PASSWORD`: Password for authentication
82-
- `CODELOGIC_MV_NAME`: Materialized view name
82+
- `CODELOGIC_WORKSPACE_NAME`: Workspace name
8383
- `CODELOGIC_DEBUG_MODE`: Enable debug logging
8484
- `CODELOGIC_TEST_MODE`: Used by test framework
8585

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ test/.env.test
1717
# Logs folder
1818
logs/
1919
.specstory/
20+
impact_analysis_result_*.md

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ To configure this MCP server in VS Code:
4242
"CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>",
4343
"CODELOGIC_USERNAME": "<my username>",
4444
"CODELOGIC_PASSWORD": "<my password>",
45-
"CODELOGIC_MV_NAME": "<my materialized view>",
45+
"CODELOGIC_WORKSPACE_NAME": "<my workspace>",
4646
"CODELOGIC_DEBUG_MODE": "true"
4747
}
4848
}
@@ -81,7 +81,7 @@ Add the following to your configuration file:
8181
"CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>",
8282
"CODELOGIC_USERNAME": "<my username>",
8383
"CODELOGIC_PASSWORD": "<my password>",
84-
"CODELOGIC_MV_NAME": "<my materialized view>"
84+
"CODELOGIC_WORKSPACE_NAME": "<my workspace>"
8585
}
8686
}
8787
}
@@ -112,7 +112,7 @@ Add the following configuration to your file:
112112
"CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>",
113113
"CODELOGIC_USERNAME": "<my username>",
114114
"CODELOGIC_PASSWORD": "<my password>",
115-
"CODELOGIC_MV_NAME": "<my materialized view>"
115+
"CODELOGIC_WORKSPACE_NAME": "<my workspace>"
116116
}
117117
}
118118
}
@@ -140,7 +140,7 @@ To configure the CodeLogic MCP server in Cursor:
140140
"CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>",
141141
"CODELOGIC_USERNAME": "<my username>",
142142
"CODELOGIC_PASSWORD": "<my password>",
143-
"CODELOGIC_MV_NAME": "<my materialized view>",
143+
"CODELOGIC_WORKSPACE_NAME": "<my workspace>",
144144
"CODELOGIC_DEBUG_MODE": "true"
145145
}
146146
}
@@ -261,7 +261,7 @@ The following environment variables can be configured to customize the behavior
261261
- `CODELOGIC_SERVER_HOST`: The URL of the CodeLogic server.
262262
- `CODELOGIC_USERNAME`: Your CodeLogic username.
263263
- `CODELOGIC_PASSWORD`: Your CodeLogic password.
264-
- `CODELOGIC_MV_NAME`: The name of the materialized view to use.
264+
- `CODELOGIC_WORKSPACE_NAME`: The name of the workspace to use.
265265
- `CODELOGIC_DEBUG_MODE`: Set to `true` to enable debug mode. When enabled, additional debug files such as `timing_log.txt` and `impact_data*.json` will be generated. Defaults to `false`.
266266

267267
### Example Configuration
@@ -271,7 +271,7 @@ The following environment variables can be configured to customize the behavior
271271
"CODELOGIC_SERVER_HOST": "<url to the server e.g. https://myco.app.codelogic.com>",
272272
"CODELOGIC_USERNAME": "<my username>",
273273
"CODELOGIC_PASSWORD": "<my password>",
274-
"CODELOGIC_MV_NAME": "<my materialized view>",
274+
"CODELOGIC_WORKSPACE_NAME": "<my workspace>",
275275
"CODELOGIC_DEBUG_MODE": "true"
276276
}
277277
```

src/codelogic_mcp_server/handlers.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@
66
"""
77
MCP tool handlers for the CodeLogic server integration.
88
9-
This module implements the handlers for MCP tool operations, specifically the
10-
get-impact tool that analyzes the potential impact of modifying a method or function.
11-
It processes requests, performs impact analysis using the CodeLogic API, and formats
12-
results for display to users.
9+
This module implements the handlers for MCP tool operations, providing two key tools:
10+
11+
1. codelogic-method-impact: Analyzes the potential impact of modifying a method or function
12+
by examining dependencies and relationships in the codebase. It processes requests,
13+
performs impact analysis using the CodeLogic API, and formats results for display.
14+
15+
2. codelogic-database-impact: Analyzes relationships between code and database entities,
16+
helping identify potential impacts when modifying database schemas, tables, views
17+
or columns. It examines both direct and indirect dependencies to surface risks.
18+
19+
The handlers process tool requests, interact with the CodeLogic API to gather impact data,
20+
and format the results in a clear, actionable format for users.
1321
"""
1422

1523
import json
@@ -117,7 +125,7 @@ async def handle_call_tool(
117125

118126

119127
async def handle_method_impact(arguments: dict | None) -> list[types.TextContent]:
120-
"""Handle the get-impact tool for method/function analysis"""
128+
"""Handle the codelogic-method-impact tool for method/function analysis"""
121129
if not arguments:
122130
sys.stderr.write("Missing arguments\n")
123131
raise ValueError("Missing arguments")
@@ -131,7 +139,7 @@ async def handle_method_impact(arguments: dict | None) -> list[types.TextContent
131139
sys.stderr.write("Method must be provided\n")
132140
raise ValueError("Method must be provided")
133141

134-
mv_id = get_mv_id(os.getenv("CODELOGIC_MV_NAME"))
142+
mv_id = get_mv_id(os.getenv("CODELOGIC_WORKSPACE_NAME") or "")
135143

136144
start_time = time.time()
137145
nodes = get_method_nodes(mv_id, method_name)

src/codelogic_mcp_server/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def get_package_version() -> str:
6969
)
7070

7171
# Encode the workspace name to ensure it is safe for use in API calls
72-
encoded_workspace_name = urllib.parse.quote(os.getenv("CODELOGIC_MV_NAME"))
72+
encoded_workspace_name = urllib.parse.quote(os.getenv("CODELOGIC_WORKSPACE_NAME") or "")
7373

7474

7575
def find_node_by_id(nodes, id):

test/.env.test.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
CODELOGIC_SERVER_HOST=https://your-instance.app.codelogic.com
66
CODELOGIC_USERNAME=your-username
77
CODELOGIC_PASSWORD=your-password
8-
CODELOGIC_MV_NAME=your-materialized-view-name
8+
CODELOGIC_WORKSPACE_NAME=your-workspace-name

test/integration_test_all.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def load_test_config(env_file=None):
2727
load_dotenv(os.path.join(project_root, '.env'))
2828

2929
return {
30-
'CODELOGIC_MV_NAME': os.getenv('CODELOGIC_MV_NAME'),
30+
'CODELOGIC_WORKSPACE_NAME': os.getenv('CODELOGIC_WORKSPACE_NAME'),
3131
'CODELOGIC_SERVER_HOST': os.getenv('CODELOGIC_SERVER_HOST'),
3232
'CODELOGIC_USERNAME': os.getenv('CODELOGIC_USERNAME'),
3333
'CODELOGIC_PASSWORD': os.getenv('CODELOGIC_PASSWORD'),
@@ -57,7 +57,7 @@ def run_impact_test(self, method_name, class_name, output_file):
5757
handle_call_tool, *_ = setup_test_environment(self.config)
5858

5959
async def run_test():
60-
result = await handle_call_tool('get-impact', {'method': method_name, 'class': class_name})
60+
result = await handle_call_tool('codelogic-method-impact', {'method': method_name, 'class': class_name})
6161

6262
self.assertIsInstance(result, list)
6363
self.assertGreater(len(result), 0)
@@ -71,15 +71,15 @@ async def run_test():
7171

7272
return asyncio.run(run_test())
7373

74-
def test_handle_call_tool_get_impact_multi_app_java(self):
74+
def test_handle_call_tool_codelogic_method_impact_multi_app_java(self):
7575
"""Test impact analysis on Java multi-app environment"""
7676
self.run_impact_test(
7777
'addPrefix',
7878
'CompanyInfo',
7979
'impact_analysis_result_multi_app_java.md'
8080
)
8181

82-
def test_handle_call_tool_get_impact_dotnet(self):
82+
def test_handle_call_tool_codelogic_method_impact_dotnet(self):
8383
"""Test impact analysis on .NET environment"""
8484
self.run_impact_test(
8585
'IsValid',
@@ -101,7 +101,7 @@ def setUpClass(cls):
101101

102102
# Initialize shared test resources
103103
cls.token = authenticate()
104-
cls.mv_name = os.getenv('CODELOGIC_MV_NAME')
104+
cls.mv_name = os.getenv('CODELOGIC_WORKSPACE_NAME')
105105
cls.mv_def_id = get_mv_definition_id(cls.mv_name, cls.token)
106106
cls.mv_id = get_mv_id_from_def(cls.mv_def_id, cls.token)
107107
cls.nodes = get_method_nodes(cls.mv_id, 'IsValid')

test/test_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"CODELOGIC_SERVER_HOST": "https://example.codelogic.test",
1717
"CODELOGIC_USERNAME": "test_user",
1818
"CODELOGIC_PASSWORD": "test_password",
19-
"CODELOGIC_MV_NAME": "test_materialized_view",
19+
"CODELOGIC_WORKSPACE_NAME": "test_workspace",
2020
"CODELOGIC_TOKEN_CACHE_TTL": "60", # Short cache for tests
2121
"CODELOGIC_METHOD_CACHE_TTL": "60",
2222
"CODELOGIC_IMPACT_CACHE_TTL": "60"

test/unit_test_handlers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def test_handle_call_tool_method(self, mock_find_node_by_id, mock_get_impa
2626
mock_find_node_by_id.side_effect = lambda nodes, id: next(node for node in nodes if node['id'] == id)
2727

2828
# Call the function
29-
result = await handle_call_tool('get-impact', {'method': 'method_name'})
29+
result = await handle_call_tool('codelogic-method-impact', {'method': 'method_name'})
3030

3131
# Assertions
3232
mock_request_context.session.send_log_message.assert_any_call(level="info", data="Materialized view ID: mv_id")
@@ -53,7 +53,7 @@ async def test_handle_call_tool_function(self, mock_find_node_by_id, mock_get_im
5353
mock_find_node_by_id.side_effect = lambda nodes, id: next(node for node in nodes if node['id'] == id)
5454

5555
# Call the function
56-
result = await handle_call_tool('get-impact', {'function': 'function_name'})
56+
result = await handle_call_tool('codelogic-method-impact', {'function': 'function_name'})
5757

5858
# Assertions
5959
mock_request_context.session.send_log_message.assert_any_call(level="info", data="Materialized view ID: mv_id")
@@ -68,19 +68,19 @@ async def test_handle_call_tool_unknown_tool(self):
6868

6969
async def test_handle_call_tool_missing_arguments(self):
7070
with self.assertRaises(ValueError) as context:
71-
await handle_call_tool('get-impact', None)
71+
await handle_call_tool('codelogic-method-impact', None)
7272
self.assertEqual(str(context.exception), "Missing arguments")
7373

7474
async def test_handle_call_tool_missing_method_function(self):
7575
with self.assertRaises(ValueError) as context:
76-
await handle_call_tool('get-impact', {})
76+
await handle_call_tool('codelogic-method-impact', {})
7777
self.assertEqual(str(context.exception), "At least one of method or function must be provided")
7878

7979
@patch('codelogic_mcp_server.handlers.server.request_context')
8080
async def test_handle_call_tool_missing_request_context(self, mock_request_context):
8181
mock_request_context.session = None
8282
with self.assertRaises(LookupError) as context:
83-
await handle_call_tool('get-impact', {'method': 'method_name'})
83+
await handle_call_tool('codelogic-method-impact', {'method': 'method_name'})
8484
self.assertEqual(str(context.exception), "Request context is not set")
8585

8686

0 commit comments

Comments
 (0)