mirror of
https://github.com/ArthurDanjou/artapi.git
synced 2026-01-25 23:00:26 +01:00
Refactor MCP API: Remove deprecated endpoints and add new resource handlers
- Deleted old API endpoints for contact, education, experiences, hobbies, languages, profile, projects, skills, and uses. - Introduced new resource handlers for contact, education, experiences, hobbies, languages, profile, projects, skills, and uses with structured responses. - Added new MCP prompts for real-time activity, contact information, hobbies, languages, profile, projects, skills, stats, and status page. - Implemented tools for fetching real-time activity, resume links, coding stats, and weather information. - Removed legacy MCP server route and replaced it with a modular approach for better maintainability.
This commit is contained in:
30
server/mcp/tools/weather.ts
Normal file
30
server/mcp/tools/weather.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export default defineMcpTool({
|
||||
description: 'Get current weather for a city',
|
||||
inputSchema: {
|
||||
city: z.string().describe('City name')
|
||||
},
|
||||
cache: '15m',
|
||||
handler: async ({ city }) => {
|
||||
try {
|
||||
const data = await $fetch(`https://wttr.in/${city}?format=j1`)
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: 'text',
|
||||
text: JSON.stringify(data, null, 2)
|
||||
}]
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
return {
|
||||
content: [{
|
||||
type: 'text',
|
||||
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
||||
}],
|
||||
isError: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user