huskies: merge 775
This commit is contained in:
@@ -152,11 +152,22 @@ export const gatewayApi = {
|
||||
return rpc.result!;
|
||||
},
|
||||
|
||||
/// Switch the active project.
|
||||
switchProject(project: string): Promise<{ ok: boolean; error?: string }> {
|
||||
return gatewayRequest<{ ok: boolean; error?: string }>(
|
||||
"/api/gateway/switch",
|
||||
{ method: "POST", body: JSON.stringify({ project }) },
|
||||
);
|
||||
/// Switch the active project via the MCP switch_project tool.
|
||||
async switchProject(project: string): Promise<{ ok: boolean; error?: string }> {
|
||||
const res = await fetch("/mcp", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
jsonrpc: "2.0",
|
||||
id: 1,
|
||||
method: "tools/call",
|
||||
params: { name: "switch_project", arguments: { project } },
|
||||
}),
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data.error) {
|
||||
return { ok: false, error: data.error.message ?? String(data.error) };
|
||||
}
|
||||
return { ok: true };
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user