This commit is contained in:
parent
4e1fb733e2
commit
47b7f0f1e3
|
|
@ -10,4 +10,4 @@
|
|||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
mcp_dummy.py
10
mcp_dummy.py
|
|
@ -17,13 +17,13 @@ def main():
|
|||
req = json.loads(line)
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
|
||||
|
||||
if "method" in req:
|
||||
method = req["method"]
|
||||
req_id = req.get("id")
|
||||
|
||||
|
||||
resp = {"jsonrpc": "2.0", "id": req_id}
|
||||
|
||||
|
||||
if method == "initialize":
|
||||
resp["result"] = {
|
||||
"protocolVersion": "2024-11-05",
|
||||
|
|
@ -51,9 +51,9 @@ def main():
|
|||
params = req.get("params", {})
|
||||
name = params.get("name")
|
||||
args = params.get("arguments", {})
|
||||
|
||||
|
||||
logging.info(f"Tool call: {name} with {args}")
|
||||
|
||||
|
||||
content = [{"type": "text", "text": f"Weather in {args.get('location')} is 25C"}]
|
||||
# For simplicity, return raw content or follow MCP spec?
|
||||
# MCP spec: result: { content: [ {type: "text", text: "..."} ] }
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ struct cli_context {
|
|||
buf.assign((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||
input_files.push_back(std::move(buf));
|
||||
return mtmd_default_marker();
|
||||
}
|
||||
}
|
||||
return std::string((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +363,7 @@ int main(int argc, char ** argv) {
|
|||
// process commands
|
||||
if (string_starts_with(buffer, "/exit")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (string_starts_with(buffer, "/regen")) {
|
||||
if (ctx_cli.messages.size() >= 2) {
|
||||
size_t last_idx = ctx_cli.messages.size() - 1;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ class mcp_server {
|
|||
if (err_thread.joinable()) {
|
||||
err_thread.join();
|
||||
}
|
||||
|
||||
|
||||
// 5. Cleanup
|
||||
if (running) {
|
||||
subprocess_destroy(&process);
|
||||
|
|
|
|||
Loading…
Reference in New Issue