feat(*): t3code-mcp connector - machines, projects, dispatch, wait, interrupt
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
"""Live smoke against a running t3code-mcp: dispatch into a project and wait.
|
||||
|
||||
uv run python scripts/smoke.py http://127.0.0.1:8000/mcp mac t3-smoke
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
|
||||
from fastmcp import Client
|
||||
|
||||
PROMPT = (
|
||||
"Smoke test from t3code-mcp. Create or overwrite `smoke.txt` in the repo root "
|
||||
"with one line: the current date and the word `ok`. Do not commit. Reply with "
|
||||
"the exact line you wrote."
|
||||
)
|
||||
|
||||
|
||||
def show(label: str, result: object) -> None:
|
||||
print(f"\n== {label}\n{json.dumps(result, ensure_ascii=False, indent=1)[:3000]}")
|
||||
|
||||
|
||||
async def main(url: str, machine: str, project: str) -> None:
|
||||
async with Client(url) as client:
|
||||
machines = (await client.call_tool("t3_machines")).structured_content
|
||||
show("t3_machines", machines)
|
||||
projects = (
|
||||
await client.call_tool("t3_projects", {"machine": machine})
|
||||
).structured_content
|
||||
show("t3_projects", projects)
|
||||
started = (
|
||||
await client.call_tool(
|
||||
"t3_dispatch",
|
||||
{"machine": machine, "project": project, "prompt": PROMPT},
|
||||
)
|
||||
).structured_content
|
||||
show("t3_dispatch", started)
|
||||
thread_id = started["thread_id"]
|
||||
waited = (
|
||||
await client.call_tool("t3_wait", {"thread_id": thread_id, "timeout": 600})
|
||||
).structured_content
|
||||
show("t3_wait", waited)
|
||||
print("\nSTATE:", waited["state"], "waited:", waited["waited"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main(*sys.argv[1:4]))
|
||||
Reference in New Issue
Block a user