aef8791151
- Added Appshell component with responsive navbar and main content area - Integrated ColorSchemeToggle for light/dark mode switching - Created Welcome component with styled title and introductory text - Developed ChatPage for LLM interaction with WebSocket support - Implemented Biblioteca for managing notes with rich text editor - Added LoginPage for user authentication with error handling - Introduced MessageList and MessageBubble components for chat messages - Styled components with CSS modules for consistent design
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
from fastmcp import FastMCP
|
|
import uuid
|
|
import datetime
|
|
import socket
|
|
import platform
|
|
import os
|
|
|
|
mcp = FastMCP()
|
|
|
|
@mcp.tool(description="Genera un UUID versión 4.")
|
|
def generate_uuid() -> str:
|
|
return str(uuid.uuid4())
|
|
|
|
@mcp.tool(description="Devuelve la fecha y hora actuales en formato ISO 8601.")
|
|
def current_datetime() -> str:
|
|
return datetime.datetime.now().isoformat()
|
|
|
|
@mcp.tool(description="Devuelve solo la fecha actual.")
|
|
def current_date() -> str:
|
|
return datetime.date.today().isoformat()
|
|
|
|
@mcp.tool(description="Devuelve el nombre del host actual.")
|
|
def get_hostname() -> str:
|
|
return socket.gethostname()
|
|
|
|
@mcp.tool(description="Devuelve el sistema operativo actual.")
|
|
def get_os() -> str:
|
|
return platform.system()
|
|
|
|
@mcp.tool(description="Devuelve el nombre del usuario actual del sistema.")
|
|
def get_current_user() -> str:
|
|
return os.getlogin()
|
|
|
|
@mcp.tool(description="Invierte un valor booleano.")
|
|
def invert_boolean(flag: bool) -> bool:
|
|
return not flag
|
|
|
|
# @mcp.tool(description="Devuelve los archivos y carpetas del directorio actual.")
|
|
# def list_current_directory() -> list[str]:
|
|
# return os.listdir()
|
|
|
|
# @mcp.tool(description="Crea un archivo con un nombre dado.")
|
|
# def create_file(filename: str) -> str:
|
|
# with open(filename, "w") as f:
|
|
# f.write("")
|
|
# return f"Archivo '{filename}' creado."
|
|
|
|
# @mcp.tool(description="Lee el contenido de un archivo de texto dado.")
|
|
# def read_file(filename: str) -> str:
|
|
# with open(filename, "r") as f:
|
|
# return f.read()
|
|
|
|
# @mcp.tool(description="Escribe contenido a un archivo, sobrescribiéndolo.")
|
|
# def write_file(filename: str, content: str) -> str:
|
|
# with open(filename, "w") as f:
|
|
# f.write(content)
|
|
# return f"Contenido escrito en '{filename}'."
|
|
|
|
@mcp.tool(description="Devuelve el número de CPUs disponibles en el sistema.")
|
|
def get_cpu_count() -> int:
|
|
return os.cpu_count()
|
|
|
|
@mcp.tool(description="Devuelve el timestamp actual (UNIX).")
|
|
def current_timestamp() -> float:
|
|
return datetime.datetime.now().timestamp()
|
|
|
|
if __name__ == "__main__":
|
|
mcp.run(transport="streamable-http", host="127.0.0.1", port=4300, path="/tools")
|
|
|