from dedalus_mcp import get_context, tool, types
@tool(description="Create new project")
async def create_project() -> str:
ctx = get_context()
server = ctx.server
if server is None:
raise RuntimeError("No active server in context")
name = await server.request_elicitation(
types.ElicitRequestParams(
message="Project name:",
requestedSchema={
"type": "object",
"properties": {"name": {"type": "string"}},
"required": ["name"],
},
)
)
if name.action != "accept" or not name.content:
return "Cancelled"
project_type = await server.request_elicitation(
types.ElicitRequestParams(
message="Project type (web/api/cli):",
requestedSchema={
"type": "object",
"properties": {"type": {"type": "string"}},
"required": ["type"],
},
)
)
if project_type.action != "accept" or not project_type.content:
return "Cancelled"
confirm = await server.request_elicitation(
types.ElicitRequestParams(
message=f"Create {project_type.content['type']} project '{name.content['name']}'?",
requestedSchema={
"type": "object",
"properties": {"confirm": {"type": "boolean"}},
"required": ["confirm"],
},
)
)
if confirm.action == "accept" and confirm.content and confirm.content.get("confirm"):
return f"Created {name.content['name']}"
return "Cancelled"