File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
src/core/prompts/instructions Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,26 @@ if (!API_KEY) {
100100 throw new Error('OPENWEATHER_API_KEY environment variable is required');
101101}
102102
103+ // Define types for OpenWeather API responses
104+ interface WeatherData {
105+ main: {
106+ temp: number;
107+ humidity: number;
108+ };
109+ weather: Array<{
110+ description: string;
111+ }>;
112+ wind: {
113+ speed: number;
114+ };
115+ }
116+
117+ interface ForecastData {
118+ list: Array<WeatherData & {
119+ dt_txt: string;
120+ }>;
121+ }
122+
103123// Create an MCP server
104124const server = new McpServer({
105125 name: "weather-server",
@@ -124,7 +144,7 @@ server.tool(
124144 },
125145 async ({ city, days = 3 }) => {
126146 try {
127- const response = await weatherApi.get('forecast', {
147+ const response = await weatherApi.get<ForecastData> ('forecast', {
128148 params: {
129149 q: city,
130150 cnt: Math.min(days, 5) * 8,
@@ -164,7 +184,7 @@ server.resource(
164184 { uri: "weather://San Francisco/current", list: true },
165185 async (uri) => {
166186 try {
167- const response = await weatherApi.get('weather', {
187+ const response = weatherApi.get<WeatherData> ('weather', {
168188 params: { q: "San Francisco" },
169189 });
170190
You can’t perform that action at this time.
0 commit comments