diff --git a/agents/impl_generator.py b/agents/impl_generator.py index aaf18b9..16a5209 100644 --- a/agents/impl_generator.py +++ b/agents/impl_generator.py @@ -5,6 +5,7 @@ from . import utils from .models import GenerationAttempt, ImplGenerationRequest + class ImplGenerator: def __init__(self, model_str: str = ''): diff --git a/agents/models.py b/agents/models.py index fc965af..61db750 100644 --- a/agents/models.py +++ b/agents/models.py @@ -1,15 +1,18 @@ from pydantic import BaseModel, Field from typing import List + class GenerationAttempt(BaseModel): code: str errors: str + class ImplGenerationRequest(BaseModel): interface_str: str test_str: str prior_attempts: List[GenerationAttempt] = Field(default_factory=list) + class TestGenerationRequest(BaseModel): interface_str: str prior_attempts: List[GenerationAttempt] = Field(default_factory=list) diff --git a/agents/test_generator.py b/agents/test_generator.py index 8792cc0..19671a8 100644 --- a/agents/test_generator.py +++ b/agents/test_generator.py @@ -5,6 +5,7 @@ from . import utils from .models import GenerationAttempt, TestGenerationRequest + class TestGenerator: def __init__(self, model_str: str = ''): diff --git a/demo.py b/demo.py index ee65afc..1bc235a 100644 --- a/demo.py +++ b/demo.py @@ -1,6 +1,6 @@ from agents import impl_generator from agents import test_generator -from pydantic import BaseModel # Import BaseModel for Pydantic +from pydantic import BaseModel # Import BaseModel for Pydantic from dotenv import load_dotenv import os import py_compile @@ -16,6 +16,7 @@ class Example(BaseModel): project_name: str filename: str + # Removed old dataclass Example definition math_utils = Example( diff --git a/mcp/server.py b/mcp/server.py index 3e94518..dff8c4d 100644 --- a/mcp/server.py +++ b/mcp/server.py @@ -9,6 +9,7 @@ # Create an MCP server instance using FastMCP mcp = FastMCP("SimpleEmailServer") + # Define the send_email tool using the decorator @mcp.tool() def send_email(to: str, subject: str, body: str) -> str: @@ -17,6 +18,7 @@ def send_email(to: str, subject: str, body: str) -> str: # In a real scenario, email sending logic would go here. return f"Email to {to} regarding '{subject}' logged successfully." + @mcp.tool() def list_files(directory_path: str = ".") -> list[str] | str: """Lists files and directories under the given directory_path relative to the server's root.""" @@ -35,6 +37,7 @@ def list_files(directory_path: str = ".") -> list[str] | str: logging.error(f"Error listing files: {e}") return f"Error: An unexpected error occurred: {str(e)}" + @mcp.tool() def read_file_content(file_path: str) -> str: """Reads the content of a specified file relative to the server's root.""" @@ -58,6 +61,7 @@ def read_file_content(file_path: str) -> str: logging.error(f"Unexpected error reading file {file_path}: {e}") return f"Error: An unexpected error occurred: {str(e)}" + # Main execution block to run the server using uvicorn if __name__ == "__main__": logging.info("Starting FastMCP server with uvicorn...") diff --git a/utils_test.py b/utils_test.py index 3323b77..702ef47 100644 --- a/utils_test.py +++ b/utils_test.py @@ -1,6 +1,7 @@ import unittest from utils import guess_classname, camel_to_snake + class UtilsTest(unittest.TestCase): def test_guess_classname_happy_path(self): code = "class MyClass(ABC): pass" @@ -10,7 +11,7 @@ def test_guess_classname_edge_case(self): code = "def my_func(): pass" with self.assertRaises(ValueError): guess_classname(code) - + def test_guess_classname_edge_case_lowercase(self): code = "class myclass(ABC): pass" with self.assertRaises(ValueError):