Skip to content

Commit 89bfaf4

Browse files
committed
feat: add Pages to Workers migration guide to docs-vectorize MCP server
1 parent cff9359 commit 89bfaf4

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.changeset/crazy-dogs-invent.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'docs-vectorize': minor
3+
---
4+
5+
feat: add Pages to Workers migration guide to docs-vectorize MCP server

apps/docs-vectorize/src/tools/docs-vectorize.tools.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,36 @@ ${result.text}
4242
}
4343
}
4444
)
45+
46+
// Note: this is a tool instead of a prompt because
47+
// prompt support is much less common than tools.
48+
agent.server.tool(
49+
'migrate_pages_to_workers_guide',
50+
`ALWAYS read this guide before migrating Pages projects to Workers.`,
51+
async () => {
52+
const res = await fetch(
53+
'https://developers.cloudflare.com/workers/prompts/pages-to-workers.txt',
54+
{
55+
cf: { cacheEverything: true, cacheTtl: 3600 },
56+
}
57+
)
58+
59+
if (!res.ok) {
60+
return {
61+
content: [{ type: 'text', text: 'Error: Failed to fetch guide. Please try again.' }],
62+
}
63+
}
64+
65+
return {
66+
content: [
67+
{
68+
type: 'text',
69+
text: await res.text(),
70+
},
71+
],
72+
}
73+
}
74+
)
4575
}
4676

4777
async function queryVectorize(ai: Ai, vectorizeIndex: VectorizeIndex, query: string, topK: number) {

0 commit comments

Comments
 (0)