Skip to content

Commit d207481

Browse files
committed
Add dump_config MCP tool
1 parent 607ee5a commit d207481

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/finecode/mcp_server.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ async def list_tools() -> list[Tool]:
7171
"required": ["project"],
7272
},
7373
),
74+
Tool(
75+
name="dump_config",
76+
description="Return the fully resolved project configuration with all presets applied and the presets key removed. Use this to understand the complete effective configuration a project runs with.",
77+
inputSchema={
78+
"type": "object",
79+
"properties": {
80+
"project": {
81+
"type": "string",
82+
"description": "Absolute path to the project directory. Use the list_projects tool to see available projects.",
83+
}
84+
},
85+
"required": ["project"],
86+
},
87+
),
7488
]
7589

7690
actions = await _wm_client.list_actions()
@@ -143,6 +157,22 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]:
143157
result = await _wm_client.get_project_raw_config(project)
144158
return [TextContent(type="text", text=json.dumps({"rawConfig": result}))]
145159

160+
if name == "dump_config":
161+
project = arguments["project"]
162+
project_path = pathlib.Path(project)
163+
raw_config = await _wm_client.get_project_raw_config(project)
164+
result = await _wm_client.run_action(
165+
"dump_config",
166+
project,
167+
params={
168+
"source_file_path": str(project_path / "pyproject.toml"),
169+
"project_raw_config": raw_config,
170+
"target_file_path": str(project_path / "finecode_config_dump" / "pyproject.toml"),
171+
},
172+
options={"resultFormats": ["json"], "trigger": "user", "devEnv": "ai"},
173+
)
174+
return [TextContent(type="text", text=json.dumps(result))]
175+
146176
project = arguments.pop("project", None)
147177
options = {"resultFormats": ["json"], "trigger": "user", "devEnv": "ai"}
148178
if project is not None:

0 commit comments

Comments
 (0)