Skip to content

Commit ab75d2c

Browse files
authored
fix(mcp): use rawbody instead of body in tools (#2214)
1 parent e90737c commit ab75d2c

6 files changed

Lines changed: 20 additions & 15 deletions

File tree

content.config.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,23 +216,26 @@ export default defineContentConfig({
216216
source: [docsV5Source, examplesV5Source],
217217
schema: z.object({
218218
titleTemplate: z.string().optional(),
219-
links: z.array(Button)
219+
links: z.array(Button),
220+
rawbody: z.string()
220221
})
221222
}),
222223
docsv4: defineCollection({
223224
type: 'page',
224225
source: [docsV4Source, examplesV4Source],
225226
schema: z.object({
226227
titleTemplate: z.string().optional(),
227-
links: z.array(Button)
228+
links: z.array(Button),
229+
rawbody: z.string()
228230
})
229231
}),
230232
docsv3: defineCollection({
231233
type: 'page',
232234
source: [docsV3Source, examplesV3Source],
233235
schema: z.object({
234236
titleTemplate: z.string().optional(),
235-
links: z.array(Button)
237+
links: z.array(Button),
238+
rawbody: z.string()
236239
})
237240
}),
238241
blog: defineCollection({
@@ -244,7 +247,8 @@ export default defineContentConfig({
244247
date: z.string().date(),
245248
draft: z.boolean().default(false),
246249
category: z.enum(['Release', 'Tutorial', 'Announcement', 'Article']),
247-
tags: z.array(z.string())
250+
tags: z.array(z.string()),
251+
rawbody: z.string()
248252
})
249253
}),
250254
landing: defineCollection({
@@ -275,7 +279,8 @@ export default defineContentConfig({
275279
logoIcon: z.string(),
276280
category: z.string(),
277281
nitroPreset: z.string(),
278-
website: z.string().url()
282+
website: z.string().url(),
283+
rawbody: z.string()
279284
})
280285
}),
281286
manualSponsors: defineCollection({

server/mcp/prompts/deployment-guide.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default defineMcpPrompt({
1010
const event = useEvent()
1111

1212
const deployProviders = await queryCollection(event, 'deploy')
13-
.select('title', 'path', 'description', 'body', 'logoSrc', 'logoIcon', 'category', 'nitroPreset', 'website', 'sponsor')
13+
.select('title', 'path', 'description', 'rawbody', 'logoSrc', 'logoIcon', 'category', 'nitroPreset', 'website', 'sponsor')
1414
.all()
1515

1616
const allProviders = deployProviders?.map(p => ({
@@ -30,7 +30,7 @@ export default defineMcpPrompt({
3030
title: matchingProvider.title,
3131
path: matchingProvider.path,
3232
description: matchingProvider.description,
33-
content: matchingProvider.body,
33+
content: matchingProvider.rawbody,
3434
logoSrc: matchingProvider.logoSrc,
3535
logoIcon: matchingProvider.logoIcon,
3636
category: matchingProvider.category,

server/mcp/tools/get-blog-post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ EXAMPLES: "/blog/v4", "/blog/nuxt3", "/blog/nuxt-on-the-edge"`,
2121

2222
const post = await queryCollection(event, 'blog')
2323
.where('path', '=', path)
24-
.select('title', 'path', 'description', 'body', 'date', 'category', 'tags', 'authors', 'image')
24+
.select('title', 'path', 'description', 'rawbody', 'date', 'category', 'tags', 'authors', 'image')
2525
.first()
2626

2727
if (!post) {
@@ -32,7 +32,7 @@ EXAMPLES: "/blog/v4", "/blog/nuxt3", "/blog/nuxt-on-the-edge"`,
3232
title: post.title,
3333
path: post.path,
3434
description: post.description,
35-
content: post.body,
35+
content: post.rawbody,
3636
date: post.date,
3737
category: post.category,
3838
tags: post.tags,

server/mcp/tools/get-deploy-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ EXAMPLES: "/deploy/vercel", "/deploy/cloudflare", "/deploy/netlify", "/deploy/aw
2121

2222
const provider = await queryCollection(event, 'deploy')
2323
.where('path', '=', path)
24-
.select('title', 'path', 'description', 'body', 'logoSrc', 'logoIcon', 'category', 'nitroPreset', 'website', 'sponsor')
24+
.select('title', 'path', 'description', 'rawbody', 'logoSrc', 'logoIcon', 'category', 'nitroPreset', 'website', 'sponsor')
2525
.first()
2626

2727
if (!provider) {
@@ -32,7 +32,7 @@ EXAMPLES: "/deploy/vercel", "/deploy/cloudflare", "/deploy/netlify", "/deploy/aw
3232
title: provider.title,
3333
path: provider.path,
3434
description: provider.description,
35-
content: provider.body,
35+
content: provider.rawbody,
3636
logoSrc: provider.logoSrc,
3737
logoIcon: provider.logoIcon,
3838
category: provider.category,

server/mcp/tools/get-documentation-page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Common Issues:
4040

4141
const page = await queryCollection(event, docsVersion)
4242
.where('path', '=', path)
43-
.select('title', 'path', 'description', 'body', 'links')
43+
.select('title', 'path', 'description', 'rawbody', 'links')
4444
.first()
4545

4646
if (!page) {
@@ -51,7 +51,7 @@ Common Issues:
5151
title: page.title,
5252
path: page.path,
5353
description: page.description,
54-
content: page.body,
54+
content: page.rawbody,
5555
version: page.path.includes('/docs/5.x') ? '5.x' : page.path.includes('/docs/4.x') ? '4.x' : '3.x',
5656
links: page.links,
5757
url: `https://nuxt.com${page.path}`

server/mcp/tools/get-getting-started-guide.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default defineMcpTool({
1515

1616
const page = await queryCollection(event, docsVersion)
1717
.where('path', '=', path)
18-
.select('title', 'path', 'description', 'body', 'links')
18+
.select('title', 'path', 'description', 'rawbody', 'links')
1919
.first()
2020

2121
if (!page) {
@@ -26,7 +26,7 @@ export default defineMcpTool({
2626
title: page.title,
2727
path: page.path,
2828
description: page.description,
29-
content: page.body,
29+
content: page.rawbody,
3030
version: version,
3131
links: page.links,
3232
url: `https://nuxt.com${page.path}`

0 commit comments

Comments
 (0)