Skip to content

Commit fcaf99d

Browse files
committed
Nick: fixed the html not being returned
1 parent 542851f commit fcaf99d

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firecrawl-mcp",
3-
"version": "1.4.2",
3+
"version": "1.5.0",
44
"description": "MCP server for FireCrawl web scraping integration. Supports both cloud and self-hosted instances. Features include web scraping, batch processing, structured data extraction, and LLM-powered content analysis.",
55
"type": "module",
66
"bin": {

src/index.ts

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -915,13 +915,40 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
915915
throw new Error(response.error || 'Scraping failed');
916916
}
917917

918-
const content =
919-
'markdown' in response
920-
? response.markdown || response.html || response.rawHtml
921-
: null;
918+
919+
// Format content based on requested formats
920+
const contentParts = [];
921+
922+
if (options.formats?.includes('markdown') && response.markdown) {
923+
contentParts.push(response.markdown);
924+
}
925+
if (options.formats?.includes('html') && response.html) {
926+
contentParts.push(response.html);
927+
}
928+
if (options.formats?.includes('rawHtml') && response.rawHtml) {
929+
contentParts.push(response.rawHtml);
930+
}
931+
if (options.formats?.includes('links') && response.links) {
932+
contentParts.push(response.links.join('\n'));
933+
}
934+
if (options.formats?.includes('screenshot') && response.screenshot) {
935+
contentParts.push(response.screenshot);
936+
}
937+
if (options.formats?.includes('extract') && response.extract) {
938+
contentParts.push(JSON.stringify(response.extract, null, 2));
939+
}
940+
941+
// Add warning to response if present
942+
if (response.warning) {
943+
server.sendLoggingMessage({
944+
level: 'warning',
945+
data: response.warning,
946+
});
947+
}
948+
922949
return {
923950
content: [
924-
{ type: 'text', text: content || 'No content available' },
951+
{ type: 'text', text: contentParts.join('\n\n') || 'No content available' },
925952
],
926953
isError: false,
927954
};

0 commit comments

Comments
 (0)