Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agents/impl_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from . import utils
from .models import GenerationAttempt, ImplGenerationRequest


class ImplGenerator:

def __init__(self, model_str: str = ''):
Expand Down
3 changes: 3 additions & 0 deletions agents/models.py
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions agents/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from . import utils
from .models import GenerationAttempt, TestGenerationRequest


class TestGenerator:

def __init__(self, model_str: str = ''):
Expand Down
3 changes: 2 additions & 1 deletion demo.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,6 +16,7 @@ class Example(BaseModel):
project_name: str
filename: str


# Removed old dataclass Example definition

math_utils = Example(
Expand Down
4 changes: 4 additions & 0 deletions mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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."""
Expand All @@ -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."""
Expand All @@ -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...")
Expand Down
3 changes: 2 additions & 1 deletion utils_test.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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):
Expand Down