mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
fix: Remove unsupported description param from project_create
GNS3 REST API ProjectCreate schema does not have a description field. The parameter was silently ignored; now removed to avoid confusion.
This commit is contained in:
parent
80e64ebbae
commit
4ec80f8989
@ -257,12 +257,9 @@ async def project_get(
|
||||
@mcp.tool()
|
||||
async def project_create(
|
||||
name: Annotated[str, Field(description="Project name")],
|
||||
description: Annotated[str, Field(description="Optional project description")] = "",
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Create a new GNS3 project."""
|
||||
params = {"name": name}
|
||||
if description:
|
||||
params["description"] = description
|
||||
return await asyncio.to_thread(_run_handler_sync, create_project_handler, params)
|
||||
|
||||
|
||||
|
||||
@ -66,10 +66,7 @@ def create_project_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) ->
|
||||
if not name:
|
||||
return {"error": "name is required"}
|
||||
conn = _get_connector(gns3_ctx)
|
||||
project_data = {"name": name}
|
||||
if "description" in params:
|
||||
project_data["description"] = params["description"]
|
||||
return conn.http_call("post", f"{conn.base_url}/projects", json_data=project_data).json()
|
||||
return conn.http_call("post", f"{conn.base_url}/projects", json_data={"name": name}).json()
|
||||
|
||||
|
||||
def delete_project_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> dict[str, Any]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user