from dedalus_mcp import get_context, tool, types
@tool(description="नया प्रोजेक्ट बनाएं")
async def create_project() -> str:
ctx = get_context()
server = ctx.server
if server is None:
raise RuntimeError("संदर्भ में कोई सक्रिय सर्वर नहीं है")
name = await server.request_elicitation(
types.ElicitRequestParams(
message="प्रोजेक्ट का नाम:",
requestedSchema={
"type": "object",
"properties": {"name": {"type": "string"}},
"required": ["name"],
},
)
)
if name.action != "accept" or not name.content:
return "रद्द किया गया"
project_type = await server.request_elicitation(
types.ElicitRequestParams(
message="प्रोजेक्ट का प्रकार (web/api/cli):",
requestedSchema={
"type": "object",
"properties": {"type": {"type": "string"}},
"required": ["type"],
},
)
)
if project_type.action != "accept" or not project_type.content:
return "रद्द किया गया"
confirm = await server.request_elicitation(
types.ElicitRequestParams(
message=f"{project_type.content['type']} प्रोजेक्ट '{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"{name.content['name']} बनाया गया"
return "रद्द किया गया"