Skip to content

Commit 316c49b

Browse files
committed
feat: use applyAppMeta in deploy tool and recover jobs.ts
### Description - Updates deploy tool to use applyAppMeta to conditionally return UI resource URI. - Recovers missing src/mcp/util/jobs.ts from compiled version. ### Scenarios Tested - Build succeeds. - Lint passes for these files.
1 parent 136a782 commit 316c49b

File tree

2 files changed

+51
-10
lines changed

2 files changed

+51
-10
lines changed

src/mcp/tools/core/deploy.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { z } from "zod";
22
import { tool } from "../../tool";
33
import { deploy as coreDeploy } from "../../../deploy";
4-
import { toContent } from "../../util";
4+
import { toContent, applyAppMeta } from "../../util";
55
import { jobTracker } from "../../util/jobs";
66

77
export const deploy = tool(
@@ -15,7 +15,7 @@ export const deploy = tool(
1515
.string()
1616
.optional()
1717
.describe(
18-
'Comma-separated list of services to deploy. Valid targets are: database, storage, firestore, functions, hosting, remoteconfig, extensions, dataconnect, apphosting, auth.',
18+
"Comma-separated list of services to deploy. Valid targets are: database, storage, firestore, functions, hosting, remoteconfig, extensions, dataconnect, apphosting, auth.",
1919
),
2020
}),
2121
annotations: {
@@ -25,9 +25,6 @@ export const deploy = tool(
2525
_meta: {
2626
requiresAuth: true,
2727
requiresProject: true,
28-
ui: {
29-
resourceUri: "ui://core/deploy/mcp-app.html",
30-
},
3128
},
3229
},
3330
async ({ only }, ctx) => {
@@ -89,10 +86,15 @@ export const deploy = tool(
8986
}
9087
})();
9188

92-
const contentRes = toContent(`Deployment started with Job ID: ${jobId}. Use deploy_status tool to track.`);
93-
return {
94-
...contentRes,
95-
structuredContent: { jobId, message: "Deployment started" },
96-
};
89+
const contentRes = toContent(
90+
`Deployment started with Job ID: ${jobId}. Use deploy_status tool to track.`,
91+
);
92+
return applyAppMeta(
93+
{
94+
...contentRes,
95+
structuredContent: { jobId, message: "Deployment started" },
96+
},
97+
"ui://core/deploy/mcp-app.html",
98+
);
9799
},
98100
);

src/mcp/util/jobs.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
export interface Job {
2+
status: "running" | "success" | "failed";
3+
progress: number;
4+
logs: string[];
5+
result?: any;
6+
error?: string;
7+
}
8+
9+
class JobTracker {
10+
private jobs = new Map<string, Job>();
11+
12+
createJob(id: string): void {
13+
this.jobs.set(id, {
14+
status: "running",
15+
progress: 0,
16+
logs: [],
17+
});
18+
}
19+
20+
updateJob(id: string, updates: Partial<Job>): void {
21+
const job = this.jobs.get(id);
22+
if (job) {
23+
Object.assign(job, updates);
24+
}
25+
}
26+
27+
addLog(id: string, log: string): void {
28+
const job = this.jobs.get(id);
29+
if (job) {
30+
job.logs.push(log);
31+
}
32+
}
33+
34+
getJob(id: string): Job | undefined {
35+
return this.jobs.get(id);
36+
}
37+
}
38+
39+
export const jobTracker = new JobTracker();

0 commit comments

Comments
 (0)