create-mcp-use-app 0.14.16 → 0.14.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,6 +47,8 @@ const fruits = [
47
47
  { fruit: "lemon", color: "bg-[#feeecd] dark:bg-[#feeecd]/10" },
48
48
  ];
49
49
 
50
+ // structuredContent schema for the search-tools result. The widget renders this
51
+ // data (it arrives as the widget's tool output / structuredContent).
50
52
  const fruitRowSchema = z.object({
51
53
  fruit: z.string(),
52
54
  color: z.string(),
@@ -55,6 +57,7 @@ const fruitRowSchema = z.object({
55
57
  server.tool(
56
58
  {
57
59
  name: "search-tools",
60
+ title: "Search fruits",
58
61
  description: "Search for fruits and display the results in a visual widget",
59
62
  schema: z.object({
60
63
  query: z.string().optional().describe("Search query to filter fruits"),
@@ -84,6 +87,8 @@ server.tool(
84
87
  // let's emulate a delay to show the loading state
85
88
  await new Promise((resolve) => setTimeout(resolve, 2000));
86
89
 
90
+ // `props` become the tool result's structuredContent (delivered to the
91
+ // widget) and are type-checked against the outputSchema above.
87
92
  return widget({
88
93
  props: { query: query ?? "", results },
89
94
  output: text(
@@ -96,6 +101,7 @@ server.tool(
96
101
  server.tool(
97
102
  {
98
103
  name: "get-fruit-details",
104
+ title: "Get fruit details",
99
105
  description: "Get detailed information about a specific fruit",
100
106
  schema: z.object({
101
107
  fruit: z.string().describe("The fruit name"),
@@ -39,10 +39,18 @@ const server = new MCPServer({
39
39
  server.tool(
40
40
  {
41
41
  name: "fetch-weather",
42
+ title: "Fetch weather",
42
43
  description: "Fetch the weather for a city",
43
44
  schema: z.object({
44
45
  city: z.string().describe("The city to fetch the weather for"),
45
46
  }),
47
+ // Declare outputSchema for any tool that returns structuredContent so clients
48
+ // can validate results and the model can reason about follow-up calls.
49
+ outputSchema: z.object({
50
+ city: z.string().describe("The city the weather is for"),
51
+ conditions: z.string().describe("Human-readable weather conditions"),
52
+ temperature: z.string().describe("Current temperature"),
53
+ }),
46
54
  // Demo stub — no network. If you call an external weather API, set openWorldHint: true.
47
55
  annotations: {
48
56
  readOnlyHint: true,
@@ -50,8 +58,10 @@ server.tool(
50
58
  openWorldHint: false,
51
59
  },
52
60
  },
61
+ // The returned object is type-checked against the `outputSchema` above:
62
+ // returning the wrong shape is a compile-time error.
53
63
  async ({ city }) => {
54
- return text(`The weather in ${city} is sunny`);
64
+ return object({ city, conditions: "sunny", temperature: "22°C" });
55
65
  }
56
66
  );
57
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mcp-use-app",
3
- "version": "0.14.16",
3
+ "version": "0.14.17",
4
4
  "type": "module",
5
5
  "description": "Create MCP-Use apps with one command",
6
6
  "author": "mcp-use, Inc.",