feat(rah-light): remove extraction tools from MCP servers
- Remove rah_extract_url, rah_extract_youtube, rah_extract_pdf tools - These tools called API endpoints that don't exist (/api/extract/*) - MCP servers now expose 11 tools (down from 14): - Node CRUD: add, search, update, get - Edge CRUD: create, query, update - Dimension CRUD: create, update, delete - Semantic search: search_embeddings Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
a088b19556
commit
0d2d4bf0fd
@@ -253,45 +253,6 @@ const searchEmbeddingsOutputSchema = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
// rah_extract_url schemas
|
|
||||||
const extractUrlInputSchema = {
|
|
||||||
url: z.string().url().describe('URL of the webpage to extract content from')
|
|
||||||
};
|
|
||||||
|
|
||||||
const extractUrlOutputSchema = {
|
|
||||||
success: z.boolean(),
|
|
||||||
title: z.string(),
|
|
||||||
content: z.string(),
|
|
||||||
chunk: z.string(),
|
|
||||||
metadata: z.record(z.any())
|
|
||||||
};
|
|
||||||
|
|
||||||
// rah_extract_youtube schemas
|
|
||||||
const extractYoutubeInputSchema = {
|
|
||||||
url: z.string().describe('YouTube video URL to extract transcript from')
|
|
||||||
};
|
|
||||||
|
|
||||||
const extractYoutubeOutputSchema = {
|
|
||||||
success: z.boolean(),
|
|
||||||
title: z.string(),
|
|
||||||
channel: z.string(),
|
|
||||||
transcript: z.string(),
|
|
||||||
metadata: z.record(z.any())
|
|
||||||
};
|
|
||||||
|
|
||||||
// rah_extract_pdf schemas
|
|
||||||
const extractPdfInputSchema = {
|
|
||||||
url: z.string().url().describe('URL of the PDF file to extract content from')
|
|
||||||
};
|
|
||||||
|
|
||||||
const extractPdfOutputSchema = {
|
|
||||||
success: z.boolean(),
|
|
||||||
title: z.string(),
|
|
||||||
content: z.string(),
|
|
||||||
chunk: z.string(),
|
|
||||||
metadata: z.record(z.any())
|
|
||||||
};
|
|
||||||
|
|
||||||
async function resolveBaseUrl() {
|
async function resolveBaseUrl() {
|
||||||
try {
|
try {
|
||||||
const value = await baseUrlResolver();
|
const value = await baseUrlResolver();
|
||||||
@@ -722,90 +683,6 @@ mcpServer.registerTool(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
mcpServer.registerTool(
|
|
||||||
'rah_extract_url',
|
|
||||||
{
|
|
||||||
title: 'Extract URL content',
|
|
||||||
description: 'Extract content from a webpage URL. Returns title, content, and metadata for creating nodes.',
|
|
||||||
inputSchema: extractUrlInputSchema,
|
|
||||||
outputSchema: extractUrlOutputSchema
|
|
||||||
},
|
|
||||||
async ({ url }) => {
|
|
||||||
const result = await callRaHApi('/api/extract/url', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ url })
|
|
||||||
});
|
|
||||||
|
|
||||||
const summary = `Extracted content from: ${result.title || 'webpage'}`;
|
|
||||||
return {
|
|
||||||
content: [{ type: 'text', text: summary }],
|
|
||||||
structuredContent: {
|
|
||||||
success: true,
|
|
||||||
title: result.title || 'Untitled',
|
|
||||||
content: result.content || '',
|
|
||||||
chunk: result.chunk || '',
|
|
||||||
metadata: result.metadata || {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
mcpServer.registerTool(
|
|
||||||
'rah_extract_youtube',
|
|
||||||
{
|
|
||||||
title: 'Extract YouTube transcript',
|
|
||||||
description: 'Extract transcript from a YouTube video. Returns title, channel, transcript, and metadata.',
|
|
||||||
inputSchema: extractYoutubeInputSchema,
|
|
||||||
outputSchema: extractYoutubeOutputSchema
|
|
||||||
},
|
|
||||||
async ({ url }) => {
|
|
||||||
const result = await callRaHApi('/api/extract/youtube', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ url })
|
|
||||||
});
|
|
||||||
|
|
||||||
const summary = `Extracted transcript from: ${result.title || 'YouTube video'}`;
|
|
||||||
return {
|
|
||||||
content: [{ type: 'text', text: summary }],
|
|
||||||
structuredContent: {
|
|
||||||
success: true,
|
|
||||||
title: result.title || 'Untitled',
|
|
||||||
channel: result.channel || 'Unknown',
|
|
||||||
transcript: result.transcript || '',
|
|
||||||
metadata: result.metadata || {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
mcpServer.registerTool(
|
|
||||||
'rah_extract_pdf',
|
|
||||||
{
|
|
||||||
title: 'Extract PDF content',
|
|
||||||
description: 'Extract content from a PDF file URL. Returns title, content, and metadata for creating nodes.',
|
|
||||||
inputSchema: extractPdfInputSchema,
|
|
||||||
outputSchema: extractPdfOutputSchema
|
|
||||||
},
|
|
||||||
async ({ url }) => {
|
|
||||||
const result = await callRaHApi('/api/extract/pdf', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ url })
|
|
||||||
});
|
|
||||||
|
|
||||||
const summary = `Extracted content from: ${result.title || 'PDF document'}`;
|
|
||||||
return {
|
|
||||||
content: [{ type: 'text', text: summary }],
|
|
||||||
structuredContent: {
|
|
||||||
success: true,
|
|
||||||
title: result.title || 'Untitled PDF',
|
|
||||||
content: result.content || '',
|
|
||||||
chunk: result.chunk || '',
|
|
||||||
metadata: result.metadata || {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
async function readRequestBody(req) {
|
async function readRequestBody(req) {
|
||||||
if (req.method !== 'POST') return undefined;
|
if (req.method !== 'POST') return undefined;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -202,45 +202,6 @@ const searchEmbeddingsOutputSchema = {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
// rah_extract_url schemas
|
|
||||||
const extractUrlInputSchema = {
|
|
||||||
url: z.string().url().describe('URL of the webpage to extract content from')
|
|
||||||
};
|
|
||||||
|
|
||||||
const extractUrlOutputSchema = {
|
|
||||||
success: z.boolean(),
|
|
||||||
title: z.string(),
|
|
||||||
content: z.string(),
|
|
||||||
chunk: z.string(),
|
|
||||||
metadata: z.record(z.any())
|
|
||||||
};
|
|
||||||
|
|
||||||
// rah_extract_youtube schemas
|
|
||||||
const extractYoutubeInputSchema = {
|
|
||||||
url: z.string().describe('YouTube video URL to extract transcript from')
|
|
||||||
};
|
|
||||||
|
|
||||||
const extractYoutubeOutputSchema = {
|
|
||||||
success: z.boolean(),
|
|
||||||
title: z.string(),
|
|
||||||
channel: z.string(),
|
|
||||||
transcript: z.string(),
|
|
||||||
metadata: z.record(z.any())
|
|
||||||
};
|
|
||||||
|
|
||||||
// rah_extract_pdf schemas
|
|
||||||
const extractPdfInputSchema = {
|
|
||||||
url: z.string().url().describe('URL of the PDF file to extract content from')
|
|
||||||
};
|
|
||||||
|
|
||||||
const extractPdfOutputSchema = {
|
|
||||||
success: z.boolean(),
|
|
||||||
title: z.string(),
|
|
||||||
content: z.string(),
|
|
||||||
chunk: z.string(),
|
|
||||||
metadata: z.record(z.any())
|
|
||||||
};
|
|
||||||
|
|
||||||
const server = new McpServer(serverInfo, { instructions });
|
const server = new McpServer(serverInfo, { instructions });
|
||||||
|
|
||||||
function logError(...args) {
|
function logError(...args) {
|
||||||
@@ -694,90 +655,6 @@ server.registerTool(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
server.registerTool(
|
|
||||||
'rah_extract_url',
|
|
||||||
{
|
|
||||||
title: 'Extract URL content',
|
|
||||||
description: 'Extract content from a webpage URL. Returns title, content, and metadata for creating nodes.',
|
|
||||||
inputSchema: extractUrlInputSchema,
|
|
||||||
outputSchema: extractUrlOutputSchema
|
|
||||||
},
|
|
||||||
async ({ url }) => {
|
|
||||||
const result = await callRaHApi('/api/extract/url', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ url })
|
|
||||||
});
|
|
||||||
|
|
||||||
const summary = `Extracted content from: ${result.title || 'webpage'}`;
|
|
||||||
return {
|
|
||||||
content: [{ type: 'text', text: summary }],
|
|
||||||
structuredContent: {
|
|
||||||
success: true,
|
|
||||||
title: result.title || 'Untitled',
|
|
||||||
content: result.content || '',
|
|
||||||
chunk: result.chunk || '',
|
|
||||||
metadata: result.metadata || {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
server.registerTool(
|
|
||||||
'rah_extract_youtube',
|
|
||||||
{
|
|
||||||
title: 'Extract YouTube transcript',
|
|
||||||
description: 'Extract transcript from a YouTube video. Returns title, channel, transcript, and metadata.',
|
|
||||||
inputSchema: extractYoutubeInputSchema,
|
|
||||||
outputSchema: extractYoutubeOutputSchema
|
|
||||||
},
|
|
||||||
async ({ url }) => {
|
|
||||||
const result = await callRaHApi('/api/extract/youtube', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ url })
|
|
||||||
});
|
|
||||||
|
|
||||||
const summary = `Extracted transcript from: ${result.title || 'YouTube video'}`;
|
|
||||||
return {
|
|
||||||
content: [{ type: 'text', text: summary }],
|
|
||||||
structuredContent: {
|
|
||||||
success: true,
|
|
||||||
title: result.title || 'Untitled',
|
|
||||||
channel: result.channel || 'Unknown',
|
|
||||||
transcript: result.transcript || '',
|
|
||||||
metadata: result.metadata || {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
server.registerTool(
|
|
||||||
'rah_extract_pdf',
|
|
||||||
{
|
|
||||||
title: 'Extract PDF content',
|
|
||||||
description: 'Extract content from a PDF file URL. Returns title, content, and metadata for creating nodes.',
|
|
||||||
inputSchema: extractPdfInputSchema,
|
|
||||||
outputSchema: extractPdfOutputSchema
|
|
||||||
},
|
|
||||||
async ({ url }) => {
|
|
||||||
const result = await callRaHApi('/api/extract/pdf', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({ url })
|
|
||||||
});
|
|
||||||
|
|
||||||
const summary = `Extracted content from: ${result.title || 'PDF document'}`;
|
|
||||||
return {
|
|
||||||
content: [{ type: 'text', text: summary }],
|
|
||||||
structuredContent: {
|
|
||||||
success: true,
|
|
||||||
title: result.title || 'Untitled PDF',
|
|
||||||
content: result.content || '',
|
|
||||||
chunk: result.chunk || '',
|
|
||||||
metadata: result.metadata || {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const transport = new StdioServerTransport();
|
const transport = new StdioServerTransport();
|
||||||
await server.connect(transport);
|
await server.connect(transport);
|
||||||
|
|||||||
Reference in New Issue
Block a user