Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/crazy-dogs-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'docs-vectorize': minor
---

feat: add Pages to Workers migration guide to docs-vectorize MCP server
30 changes: 30 additions & 0 deletions apps/docs-vectorize/src/tools/docs-vectorize.tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,36 @@ ${result.text}
}
}
)

// Note: this is a tool instead of a prompt because
// prompt support is much less common than tools.
agent.server.tool(
'migrate_pages_to_workers_guide',
`ALWAYS read this guide before migrating Pages projects to Workers.`,
async () => {
const res = await fetch(
'https://developers.cloudflare.com/workers/prompts/pages-to-workers.txt',
{
cf: { cacheEverything: true, cacheTtl: 3600 },
}
)

if (!res.ok) {
return {
content: [{ type: 'text', text: 'Error: Failed to fetch guide. Please try again.' }],
}
}

return {
content: [
{
type: 'text',
text: await res.text(),
},
],
}
}
)
}

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