mirror of
https://github.com/ArthurDanjou/artapi.git
synced 2026-01-14 19:09:25 +01:00
feat: ajouter la gestion de l'éducation avec des fichiers de configuration et des ressources associées
This commit is contained in:
@@ -60,6 +60,17 @@ export default defineContentConfig({
|
||||
description: z.string(),
|
||||
tags: z.array(z.string())
|
||||
})
|
||||
}),
|
||||
education: defineCollection({
|
||||
type: 'data',
|
||||
source: 'education/*.md',
|
||||
schema: z.object({
|
||||
degree: z.string(),
|
||||
institution: z.string(),
|
||||
startDate: z.string(),
|
||||
endDate: z.string().optional(),
|
||||
location: z.string()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
7
content/education/bachelor.md
Normal file
7
content/education/bachelor.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
degree: Bachelor's Degree in Mathematics
|
||||
institution: Paris-Saclay University
|
||||
location: Paris, France
|
||||
startDate: 2021-09
|
||||
endDate: 2024-06
|
||||
---
|
||||
7
content/education/m1.md
Normal file
7
content/education/m1.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
degree: First year Master's Degree in Applied Mathematics
|
||||
institution: Paris Dauphine-PSL University
|
||||
location: Paris, France
|
||||
startDate: 2023-09
|
||||
endDate: 2024-06
|
||||
---
|
||||
7
content/education/m2.md
Normal file
7
content/education/m2.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
degree: Second year Master's Degree in Applied Mathematics
|
||||
institution: Paris Dauphine-PSL University
|
||||
location: Paris, France
|
||||
startDate: 2024-09
|
||||
endDate: 2025-10
|
||||
---
|
||||
12
server/api/educations.get.ts
Normal file
12
server/api/educations.get.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { queryCollection } from '@nuxt/content/server'
|
||||
|
||||
export default defineCachedEventHandler(async (event) => {
|
||||
return {
|
||||
body: await queryCollection(event, 'education')
|
||||
.where('extension', '=', 'md')
|
||||
.all()
|
||||
}
|
||||
}, {
|
||||
name: 'educations-list',
|
||||
maxAge: 3600 // 1 hour
|
||||
})
|
||||
@@ -1,5 +1,6 @@
|
||||
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'
|
||||
import { z } from '@nuxt/content'
|
||||
|
||||
function createServer() {
|
||||
const server = new McpServer({
|
||||
@@ -7,9 +8,142 @@ function createServer() {
|
||||
version: '1.0.0'
|
||||
})
|
||||
|
||||
// Ressources
|
||||
server.registerResource(
|
||||
'artmcp-skills',
|
||||
'resource://artmcp/skills',
|
||||
{
|
||||
title: 'ArtMCP Skills',
|
||||
description: 'Complete list of skills of Arthur Danjou'
|
||||
},
|
||||
async (uri) => {
|
||||
const result = await $fetch('/api/skills')
|
||||
return {
|
||||
contents: [{
|
||||
uri: uri.href,
|
||||
mimeType: 'application/json',
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
server.registerResource(
|
||||
'artmcp-experiences',
|
||||
'resource://artmcp/experiences',
|
||||
{
|
||||
title: 'ArtMCP Experiences',
|
||||
description: 'Complete list of experiences of Arthur Danjou'
|
||||
},
|
||||
async (uri) => {
|
||||
const result = await $fetch('/api/experiences')
|
||||
return {
|
||||
contents: [{
|
||||
uri: uri.href,
|
||||
mimeType: 'application/json',
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
server.registerResource(
|
||||
'artmcp-projects',
|
||||
'resource://artmcp/projects',
|
||||
{
|
||||
title: 'ArtMCP Projects',
|
||||
description: 'Complete list of projects of Arthur Danjou'
|
||||
},
|
||||
async (uri) => {
|
||||
const result = await $fetch('/api/projects')
|
||||
return {
|
||||
contents: [{
|
||||
uri: uri.href,
|
||||
mimeType: 'application/json',
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
server.registerResource(
|
||||
'artmcp-uses',
|
||||
'resource://artmcp/uses',
|
||||
{
|
||||
title: 'ArtMCP Uses',
|
||||
description: 'Complete list of uses of Arthur Danjou filtered by categories'
|
||||
},
|
||||
async (uri) => {
|
||||
const result = await $fetch('/api/uses')
|
||||
return {
|
||||
contents: [{
|
||||
uri: uri.href,
|
||||
mimeType: 'application/json',
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
server.registerResource(
|
||||
'artmcp-education',
|
||||
'resource://artmcp/education',
|
||||
{
|
||||
title: 'ArtMCP Education',
|
||||
description: 'Complete list of education of Arthur Danjou'
|
||||
},
|
||||
async (uri) => {
|
||||
const result = await $fetch('/api/educations')
|
||||
return {
|
||||
contents: [{
|
||||
uri: uri.href,
|
||||
mimeType: 'application/json',
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// Tools
|
||||
server.registerTool(
|
||||
'get_resume_link',
|
||||
{
|
||||
title: 'Get Resume Link',
|
||||
description: 'Provide a link to download Arthur Danjou\'s resume in the requested language.',
|
||||
inputSchema: {
|
||||
lang: z.enum(['en', 'fr']).describe('The language for the resume, \'en\' or \'fr\'.')
|
||||
}
|
||||
},
|
||||
async ({ lang }) => {
|
||||
const url = `https://mcp.arthurdanjou.fr/api/resumes/${lang}`
|
||||
return {
|
||||
content: [{ type: 'text', text: JSON.stringify(url, null, 2) }]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// Prompts : toutes les commandes de artchat
|
||||
// Ressources : toutes les ressources de Nuxt Content
|
||||
// Tools : toutes les actions
|
||||
server.registerPrompt(
|
||||
'artmcp-resume',
|
||||
{
|
||||
title: 'Get Resume of Arthur Danjou',
|
||||
description: 'Get Resume in French or English format of Arthur Danjou',
|
||||
argsSchema: {
|
||||
lang: z.enum(['en', 'fr']).describe('The language for the resume, \'en\' or \'fr\'.')
|
||||
}
|
||||
},
|
||||
async ({ lang }) => {
|
||||
return {
|
||||
messages: [{
|
||||
role: 'user',
|
||||
content: {
|
||||
type: 'text',
|
||||
text: `Provide me the link to download Arthur Danjou's resume in ${lang === 'en' ? 'English' : 'French'}.`
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return server
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user