Skip to content

Commit f65bfc8

Browse files
committed
cleaning up
1 parent 36c83b3 commit f65bfc8

File tree

2 files changed

+5
-54
lines changed

2 files changed

+5
-54
lines changed

myclient.py

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
1-
# import asyncio
2-
# from fastmcp import Client
3-
#
4-
# client = Client("myserver.py")
5-
#
6-
# async def call_tool(file: str, function: str)-> None:
7-
# async with client:
8-
# result = await client.call_tool("optimize_code", {"file": f"{file}", "function":f"{function}"})
9-
# print(result)
10-
#
11-
# asyncio.run(call_tool("Ford","Mustang"))
12-
13-
141
import anthropic
152
from rich import print
16-
17-
# Your server URL (replace with your actual URL)
183
url = 'https://0de03d07f8b9.ngrok-free.app'
19-
204
client = anthropic.Anthropic()
21-
22-
#file and fn names are hard coded for now
235
response = client.beta.messages.create(
246
model="claude-sonnet-4-20250514",
257
max_tokens=1000,
@@ -28,39 +10,11 @@
2810
{
2911
"type": "url",
3012
"url": f"{url}/mcp/",
31-
"name": "HelpfulAssistant",
13+
"name": "Code Optimization Assistant",
3214
}
3315
],
3416
extra_headers={
3517
"anthropic-beta": "mcp-client-2025-04-04"
3618
}
3719
)
38-
39-
print(response.content)
40-
41-
42-
# import anthropic
43-
# from rich import print
44-
#
45-
# # Your server URL (replace with your actual URL)
46-
# url = 'https://0de03d07f8b9.ngrok-free.app'
47-
#
48-
# client = anthropic.Anthropic()
49-
#
50-
# response = client.beta.messages.create(
51-
# model="claude-sonnet-4-20250514",
52-
# max_tokens=1000,
53-
# messages=[{"role": "user", "content": "Roll a few dice!"}],
54-
# mcp_servers=[
55-
# {
56-
# "type": "url",
57-
# "url": f"{url}/mcp/",
58-
# "name": "Dice Roller",
59-
# }
60-
# ],
61-
# extra_headers={
62-
# "anthropic-beta": "mcp-client-2025-04-04"
63-
# }
64-
# )
65-
#
66-
# print(response.content)
20+
print(response.content)

myserver.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import pathlib
2-
32
from fastmcp import FastMCP
4-
53
from tests.scripts.end_to_end_test_utilities import CoverageExpectation, TestConfig, run_codeflash_command
6-
7-
mcp = FastMCP(name="HelpfulAssistant",
4+
mcp = FastMCP(name="Code Optimization Assistant",
85
instructions="""
96
This server provides code optimization tools.
107
Call optimize_code(file, function) to optimize your code.
11-
""",)
8+
""")
129

1310
@mcp.tool
1411
def optimize_code(file: str, function: str) -> bool:
@@ -23,7 +20,7 @@ def optimize_code(file: str, function: str) -> bool:
2320
)
2421
],
2522
)
26-
cwd = (pathlib.Path(__file__).parent/ "code_to_optimize").resolve() # todo remove it
23+
cwd = (pathlib.Path(__file__).parent/ "code_to_optimize").resolve() # TODO remove it
2724
return run_codeflash_command(
2825
cwd, config, 100, ['print("codeflash stdout: Sorting list")', 'print(f"result: {arr}")']
2926
)

0 commit comments

Comments
 (0)