Skip to content

Commit 179b7a1

Browse files
authored
fix: improve prompt (#13832)
1 parent 761bafa commit 179b7a1

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

packages/mcp-server/.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"type": "npm",
66
"script": "watch",
7-
"problemMatcher": ["$tsc-watch"],
7+
"problemMatcher": ["$ts-webpack-watch"],
88
"isBackground": true,
99
"label": "npm: watch",
1010
"group": {

packages/mcp-server/src/fetcher.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type SchemaType = z.infer<typeof SchemaTypeEnum>;
1717
*/
1818
interface SchemaRepository {
1919
baseUrl: string;
20+
latestVersion: string;
2021
}
2122

2223
/**
@@ -25,12 +26,15 @@ interface SchemaRepository {
2526
const schemaRepositories: Record<SchemaType, SchemaRepository> = {
2627
app_manifest: {
2728
baseUrl: `https://developer.microsoft.com/json-schemas/teams/{{version}}/MicrosoftTeams.schema.json`,
29+
latestVersion: "v1.21",
2830
},
2931
declarative_agent_manifest: {
3032
baseUrl: `https://developer.microsoft.com/json-schemas/copilot/declarative-agent/{{version}}/schema.json`,
33+
latestVersion: "v1.3",
3134
},
3235
api_plugin_manifest: {
3336
baseUrl: `https://developer.microsoft.com/json-schemas/copilot/plugin/{{version}}/schema.json`,
37+
latestVersion: "v2.2",
3438
},
3539
};
3640

@@ -69,6 +73,10 @@ export async function fetchSchema(schemaName: SchemaType, schemaVersion: string)
6973
}
7074

7175
try {
76+
if (schemaVersion === "latest") {
77+
schemaVersion = repository.latestVersion;
78+
}
79+
7280
const url = repository.baseUrl.replace("{{version}}", schemaVersion);
7381
const response = await fetch(url);
7482

packages/mcp-server/src/server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ export function createServer(): McpServer {
1515
'Get the schema for "App manifest", "Declarative agent manifest", "API plugin manifest", use it everytime before understanding, modifying or creating any of these manifest files.',
1616
{
1717
schema_name: SchemaTypeEnum.describe("name of schema"),
18-
schema_version: z.string().describe("version of schema"),
18+
schema_version: z
19+
.string()
20+
.describe(
21+
'version of schema in semantic versioning format vX.Y, where X is the major version and Y is the minor version (e.g. v1.0, v1.19, v2.1). Use "latest" if unsure.'
22+
),
1923
},
2024
async ({ schema_name, schema_version }) => {
2125
const schema = await fetchSchema(schema_name, schema_version);

packages/mcp-server/tests/fetcher.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,30 @@ describe("fetcher", () => {
5555
);
5656
});
5757

58+
it("should handle 'latest' version by using the repository's latest version", async () => {
59+
// Test app_manifest with 'latest' version
60+
await fetchSchema("app_manifest", "latest");
61+
expect(global.fetch).toHaveBeenCalledWith(
62+
"https://developer.microsoft.com/json-schemas/teams/v1.21/MicrosoftTeams.schema.json"
63+
);
64+
65+
jest.clearAllMocks();
66+
67+
// Test declarative_agent_manifest with 'latest' version
68+
await fetchSchema("declarative_agent_manifest", "latest");
69+
expect(global.fetch).toHaveBeenCalledWith(
70+
"https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.3/schema.json"
71+
);
72+
73+
jest.clearAllMocks();
74+
75+
// Test api_plugin_manifest with 'latest' version
76+
await fetchSchema("api_plugin_manifest", "latest");
77+
expect(global.fetch).toHaveBeenCalledWith(
78+
"https://developer.microsoft.com/json-schemas/copilot/plugin/v2.2/schema.json"
79+
);
80+
});
81+
5882
it("should cache results for repeated requests", async () => {
5983
// First call should make a fetch request
6084
await fetchSchema("app_manifest", "v1.16");

0 commit comments

Comments
 (0)