@houtini/gemini-mcp 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +784 -940
- package/dist/cli.js +5 -10
- package/dist/cli.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +4 -41
- package/dist/config/index.js.map +1 -1
- package/dist/config/types.js +1 -2
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +182 -90
- package/dist/index.js.map +1 -1
- package/dist/services/base-service.js +3 -10
- package/dist/services/base-service.js.map +1 -1
- package/dist/services/gemini/index.d.ts +3 -3
- package/dist/services/gemini/index.d.ts.map +1 -1
- package/dist/services/gemini/index.js +20 -24
- package/dist/services/gemini/index.js.map +1 -1
- package/dist/services/gemini/types.js +1 -2
- package/dist/tools/gemini-chat.d.ts +1 -1
- package/dist/tools/gemini-chat.d.ts.map +1 -1
- package/dist/tools/gemini-chat.js +10 -17
- package/dist/tools/gemini-chat.js.map +1 -1
- package/dist/tools/gemini-deep-research.d.ts +1 -1
- package/dist/tools/gemini-deep-research.d.ts.map +1 -1
- package/dist/tools/gemini-deep-research.js +24 -31
- package/dist/tools/gemini-deep-research.js.map +1 -1
- package/dist/tools/gemini-list-models.d.ts +1 -1
- package/dist/tools/gemini-list-models.d.ts.map +1 -1
- package/dist/tools/gemini-list-models.js +7 -14
- package/dist/tools/gemini-list-models.js.map +1 -1
- package/dist/utils/error-handler.js +7 -18
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/logger.js +4 -39
- package/dist/utils/logger.js.map +1 -1
- package/package.json +7 -5
- package/dist/tools/gemini-describe-video.d.ts +0 -38
- package/dist/tools/gemini-describe-video.d.ts.map +0 -1
- package/dist/tools/gemini-describe-video.js +0 -196
- package/dist/tools/gemini-describe-video.js.map +0 -1
package/dist/utils/logger.js
CHANGED
|
@@ -1,40 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const winston = __importStar(require("winston"));
|
|
37
|
-
const config_1 = require("../config");
|
|
1
|
+
import * as winston from 'winston';
|
|
2
|
+
import { config } from '../config/index.js';
|
|
38
3
|
const transports = [
|
|
39
4
|
new winston.transports.File({
|
|
40
5
|
filename: 'logs/error.log',
|
|
@@ -49,11 +14,11 @@ if (process.env.NODE_ENV === 'development' || process.env.DEBUG_MCP === 'true')
|
|
|
49
14
|
transports.push(new winston.transports.Console());
|
|
50
15
|
}
|
|
51
16
|
const logger = winston.createLogger({
|
|
52
|
-
level:
|
|
17
|
+
level: config.logging.level,
|
|
53
18
|
format: winston.format.combine(winston.format.timestamp(), winston.format.errors({ stack: true }), winston.format.colorize(), winston.format.printf(({ timestamp, level, message, stack }) => {
|
|
54
19
|
return `${timestamp} [${level}]: ${message}${stack ? '\n' + stack : ''}`;
|
|
55
20
|
})),
|
|
56
21
|
transports
|
|
57
22
|
});
|
|
58
|
-
|
|
23
|
+
export default logger;
|
|
59
24
|
//# sourceMappingURL=logger.js.map
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,UAAU,GAAwB;IACtC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;QAC1B,QAAQ,EAAE,gBAAgB;QAC1B,KAAK,EAAE,OAAO;KACf,CAAC;IACF,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;QAC1B,QAAQ,EAAE,mBAAmB;KAC9B,CAAC;CACH,CAAC;AAEF,+EAA+E;AAC/E,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;IAC/E,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK;IAC3B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EACtC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QAC7D,OAAO,GAAG,SAAS,KAAK,KAAK,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC3E,CAAC,CAAC,CACH;IACD,UAAU;CACX,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@houtini/gemini-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "Professional Model Context Protocol server for Google Gemini AI models with enterprise-grade features",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
@@ -57,13 +58,14 @@
|
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
60
|
"@google/generative-ai": "^0.24.1",
|
|
60
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
61
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
61
62
|
"dotenv": "^16.4.5",
|
|
62
|
-
"winston": "^3.14.0"
|
|
63
|
+
"winston": "^3.14.0",
|
|
64
|
+
"zod": "^3.25.0"
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
65
67
|
"@types/jest": "^29.5.0",
|
|
66
|
-
"@types/node": "^
|
|
68
|
+
"@types/node": "^25.1.0",
|
|
67
69
|
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
|
68
70
|
"@typescript-eslint/parser": "^8.45.0",
|
|
69
71
|
"eslint": "^8.57.0",
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
"typescript": "^5.5.0"
|
|
74
76
|
},
|
|
75
77
|
"engines": {
|
|
76
|
-
"node": ">=
|
|
78
|
+
"node": ">=18.0.0",
|
|
77
79
|
"npm": ">=10.0.0"
|
|
78
80
|
},
|
|
79
81
|
"files": [
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { TextContent, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import { GeminiService } from '../services/gemini';
|
|
3
|
-
export interface VideoDescriptionRequest {
|
|
4
|
-
url: string;
|
|
5
|
-
detail_level?: 'brief' | 'standard' | 'comprehensive';
|
|
6
|
-
accessibility_mode?: boolean;
|
|
7
|
-
include_timestamps?: boolean;
|
|
8
|
-
output_format?: 'narrative' | 'structured';
|
|
9
|
-
focus?: 'actions' | 'visual_elements' | 'text_on_screen' | 'all';
|
|
10
|
-
}
|
|
11
|
-
export interface VideoScene {
|
|
12
|
-
timestamp: string;
|
|
13
|
-
description: string;
|
|
14
|
-
actions?: string[];
|
|
15
|
-
tools_visible?: string[];
|
|
16
|
-
text_on_screen?: string | null;
|
|
17
|
-
spatial_notes?: string;
|
|
18
|
-
colors?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface StructuredVideoDescription {
|
|
21
|
-
video_title?: string;
|
|
22
|
-
duration?: string;
|
|
23
|
-
scene_count: number;
|
|
24
|
-
scenes: VideoScene[];
|
|
25
|
-
key_techniques?: string[];
|
|
26
|
-
tools_list?: string[];
|
|
27
|
-
materials_list?: string[];
|
|
28
|
-
safety_notes?: string[];
|
|
29
|
-
summary: string;
|
|
30
|
-
}
|
|
31
|
-
export declare class GeminiDescribeVideoTool {
|
|
32
|
-
private geminiService;
|
|
33
|
-
constructor(geminiService: GeminiService);
|
|
34
|
-
getDefinition(): Tool;
|
|
35
|
-
private buildAccessibilityPrompt;
|
|
36
|
-
execute(args: any): Promise<TextContent[]>;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=gemini-describe-video.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-describe-video.d.ts","sourceRoot":"","sources":["../../src/tools/gemini-describe-video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,eAAe,CAAC;IACtD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAC3C,KAAK,CAAC,EAAE,SAAS,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,KAAK,CAAC;CAClE;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,uBAAuB;IACtB,OAAO,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAEhD,aAAa,IAAI,IAAI;IA6CrB,OAAO,CAAC,wBAAwB;IA8E1B,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CA4EjD"}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GeminiDescribeVideoTool = void 0;
|
|
7
|
-
const error_handler_1 = require("../utils/error-handler");
|
|
8
|
-
const logger_1 = __importDefault(require("../utils/logger"));
|
|
9
|
-
class GeminiDescribeVideoTool {
|
|
10
|
-
geminiService;
|
|
11
|
-
constructor(geminiService) {
|
|
12
|
-
this.geminiService = geminiService;
|
|
13
|
-
}
|
|
14
|
-
getDefinition() {
|
|
15
|
-
return {
|
|
16
|
-
name: 'gemini_describe_video',
|
|
17
|
-
description: 'Generate detailed audio description of YouTube video content for accessibility. Analyzes visual content including actions, spatial relationships, text overlays, and provides time-stamped descriptions.',
|
|
18
|
-
inputSchema: {
|
|
19
|
-
type: 'object',
|
|
20
|
-
properties: {
|
|
21
|
-
url: {
|
|
22
|
-
type: 'string',
|
|
23
|
-
description: 'YouTube URL to analyze'
|
|
24
|
-
},
|
|
25
|
-
detail_level: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
enum: ['brief', 'standard', 'comprehensive'],
|
|
28
|
-
default: 'standard',
|
|
29
|
-
description: 'Level of detail in descriptions: brief (high-level summary), standard (balanced), comprehensive (extensive detail)'
|
|
30
|
-
},
|
|
31
|
-
accessibility_mode: {
|
|
32
|
-
type: 'boolean',
|
|
33
|
-
default: true,
|
|
34
|
-
description: 'Include spatial descriptions, colors, text overlays, and other visual details important for accessibility'
|
|
35
|
-
},
|
|
36
|
-
include_timestamps: {
|
|
37
|
-
type: 'boolean',
|
|
38
|
-
default: true,
|
|
39
|
-
description: 'Include timestamps for all major actions and scene changes'
|
|
40
|
-
},
|
|
41
|
-
output_format: {
|
|
42
|
-
type: 'string',
|
|
43
|
-
enum: ['narrative', 'structured'],
|
|
44
|
-
default: 'structured',
|
|
45
|
-
description: 'Output format: narrative (prose description) or structured (JSON with sections for easy navigation)'
|
|
46
|
-
},
|
|
47
|
-
focus: {
|
|
48
|
-
type: 'string',
|
|
49
|
-
enum: ['actions', 'visual_elements', 'text_on_screen', 'all'],
|
|
50
|
-
default: 'all',
|
|
51
|
-
description: 'What aspects to focus on: actions (what people do), visual_elements (objects, colors, composition), text_on_screen (captions, overlays), or all'
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
required: ['url']
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
buildAccessibilityPrompt(request) {
|
|
59
|
-
const detailLevelInstructions = {
|
|
60
|
-
brief: 'Provide a concise 2-3 paragraph summary of the video content.',
|
|
61
|
-
standard: 'Provide a balanced description with key scenes and actions, approximately 5-8 scenes.',
|
|
62
|
-
comprehensive: 'Provide extensive detail for every significant action and visual element, breaking the video into 10-15+ distinct scenes.'
|
|
63
|
-
};
|
|
64
|
-
const focusInstructions = {
|
|
65
|
-
actions: 'Focus primarily on what people are doing - movements, gestures, tool usage, and procedures.',
|
|
66
|
-
visual_elements: 'Focus on visual composition - objects, colors, spatial relationships, and visual design.',
|
|
67
|
-
text_on_screen: 'Focus on any text, captions, overlays, or written information visible in the video.',
|
|
68
|
-
all: 'Provide comprehensive coverage of actions, visual elements, and text equally.'
|
|
69
|
-
};
|
|
70
|
-
const accessibilityInstructions = request.accessibility_mode ? `
|
|
71
|
-
ACCESSIBILITY MODE REQUIREMENTS:
|
|
72
|
-
- Describe spatial relationships explicitly (e.g., "on the left side of the frame", "in the upper right corner", "moving from left to right")
|
|
73
|
-
- Include colors where relevant to understanding (e.g., "red laser line", "blue button")
|
|
74
|
-
- Transcribe ALL text overlays, captions, and on-screen text verbatim
|
|
75
|
-
- Describe facial expressions and body language when relevant
|
|
76
|
-
- Note sound cues if visible (e.g., "person speaking", "tool making noise", "music playing")
|
|
77
|
-
- Use clear, concrete language - avoid "this", "that", "here", "there" without context
|
|
78
|
-
- Describe what IS happening, not what viewers should do
|
|
79
|
-
- For tools and objects, describe them before using pronouns
|
|
80
|
-
` : '';
|
|
81
|
-
const timestampInstructions = request.include_timestamps ? `
|
|
82
|
-
- Include precise timestamps for every scene or major action (format: MM:SS or H:MM:SS)
|
|
83
|
-
- Mark when new scenes begin, when actions change, when new tools appear
|
|
84
|
-
` : '';
|
|
85
|
-
const outputFormatInstructions = request.output_format === 'structured' ? `
|
|
86
|
-
OUTPUT FORMAT: Return a valid JSON object with this exact structure:
|
|
87
|
-
{
|
|
88
|
-
"video_title": "Brief title if discernible",
|
|
89
|
-
"duration": "Total video length (MM:SS format)",
|
|
90
|
-
"scene_count": number,
|
|
91
|
-
"scenes": [
|
|
92
|
-
{
|
|
93
|
-
"timestamp": "0:00-0:45",
|
|
94
|
-
"description": "Detailed description of what's happening",
|
|
95
|
-
"actions": ["action 1", "action 2"],
|
|
96
|
-
"tools_visible": ["tool 1", "tool 2"],
|
|
97
|
-
"text_on_screen": "Exact text shown, or null",
|
|
98
|
-
"spatial_notes": "Spatial relationships if relevant",
|
|
99
|
-
"colors": "Color descriptions if relevant"
|
|
100
|
-
}
|
|
101
|
-
],
|
|
102
|
-
"key_techniques": ["technique 1", "technique 2"],
|
|
103
|
-
"tools_list": ["complete list of all tools shown"],
|
|
104
|
-
"materials_list": ["all materials used"],
|
|
105
|
-
"safety_notes": ["any safety considerations visible"],
|
|
106
|
-
"summary": "2-3 sentence overall summary"
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
CRITICAL: Return ONLY valid JSON. Do not include any text before or after the JSON object.
|
|
110
|
-
` : `
|
|
111
|
-
OUTPUT FORMAT: Return a narrative prose description with clear paragraphs.
|
|
112
|
-
${request.include_timestamps ? 'Start each major section with timestamps in [MM:SS] format.' : ''}
|
|
113
|
-
`;
|
|
114
|
-
return `You are analyzing a YouTube video to create an audio description for accessibility purposes.
|
|
115
|
-
|
|
116
|
-
VIDEO URL: ${request.url}
|
|
117
|
-
|
|
118
|
-
DETAIL LEVEL: ${request.detail_level || 'standard'}
|
|
119
|
-
${detailLevelInstructions[request.detail_level || 'standard']}
|
|
120
|
-
|
|
121
|
-
FOCUS: ${request.focus || 'all'}
|
|
122
|
-
${focusInstructions[request.focus || 'all']}
|
|
123
|
-
|
|
124
|
-
${accessibilityInstructions}
|
|
125
|
-
${timestampInstructions}
|
|
126
|
-
${outputFormatInstructions}
|
|
127
|
-
|
|
128
|
-
Analyze the video and provide the description according to these requirements.`;
|
|
129
|
-
}
|
|
130
|
-
async execute(args) {
|
|
131
|
-
try {
|
|
132
|
-
logger_1.default.info('Executing gemini_describe_video tool', {
|
|
133
|
-
url: args.url,
|
|
134
|
-
detail_level: args.detail_level,
|
|
135
|
-
accessibility_mode: args.accessibility_mode,
|
|
136
|
-
output_format: args.output_format
|
|
137
|
-
});
|
|
138
|
-
if (!args.url) {
|
|
139
|
-
throw new error_handler_1.McpError('URL is required', 'INVALID_PARAMS');
|
|
140
|
-
}
|
|
141
|
-
// Validate YouTube URL
|
|
142
|
-
if (!args.url.includes('youtube.com') && !args.url.includes('youtu.be')) {
|
|
143
|
-
throw new error_handler_1.McpError('Only YouTube URLs are supported', 'INVALID_PARAMS');
|
|
144
|
-
}
|
|
145
|
-
const request = {
|
|
146
|
-
url: args.url,
|
|
147
|
-
detail_level: args.detail_level || 'standard',
|
|
148
|
-
accessibility_mode: args.accessibility_mode !== false, // Default true
|
|
149
|
-
include_timestamps: args.include_timestamps !== false, // Default true
|
|
150
|
-
output_format: args.output_format || 'structured',
|
|
151
|
-
focus: args.focus || 'all'
|
|
152
|
-
};
|
|
153
|
-
const prompt = this.buildAccessibilityPrompt(request);
|
|
154
|
-
// Use Gemini 2.5 Flash for video understanding (best model for this task)
|
|
155
|
-
const response = await this.geminiService.chat({
|
|
156
|
-
message: prompt,
|
|
157
|
-
model: 'gemini-2.5-flash',
|
|
158
|
-
temperature: 0.3, // Lower temperature for more consistent, factual descriptions
|
|
159
|
-
maxTokens: 16000, // Comprehensive descriptions may be lengthy
|
|
160
|
-
grounding: false // Don't use web search for video analysis
|
|
161
|
-
});
|
|
162
|
-
// If structured output requested, try to parse and validate JSON
|
|
163
|
-
if (request.output_format === 'structured') {
|
|
164
|
-
try {
|
|
165
|
-
// Remove markdown code blocks if present
|
|
166
|
-
let cleanedContent = response.content.trim();
|
|
167
|
-
cleanedContent = cleanedContent.replace(/```json\n?/g, '').replace(/```\n?/g, '');
|
|
168
|
-
const parsed = JSON.parse(cleanedContent);
|
|
169
|
-
// Validate basic structure
|
|
170
|
-
if (!parsed.scenes || !Array.isArray(parsed.scenes)) {
|
|
171
|
-
logger_1.default.warn('Structured output missing scenes array, returning raw response');
|
|
172
|
-
return (0, error_handler_1.createToolResult)(true, response.content);
|
|
173
|
-
}
|
|
174
|
-
// Return formatted JSON
|
|
175
|
-
return (0, error_handler_1.createToolResult)(true, JSON.stringify(parsed, null, 2));
|
|
176
|
-
}
|
|
177
|
-
catch (parseError) {
|
|
178
|
-
logger_1.default.warn('Failed to parse structured output as JSON, returning raw response', {
|
|
179
|
-
error: parseError.message
|
|
180
|
-
});
|
|
181
|
-
return (0, error_handler_1.createToolResult)(true, response.content);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return (0, error_handler_1.createToolResult)(true, response.content);
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
logger_1.default.error('gemini_describe_video tool execution failed', { error });
|
|
188
|
-
if (error instanceof error_handler_1.McpError) {
|
|
189
|
-
return (0, error_handler_1.createToolResult)(false, error.message, error);
|
|
190
|
-
}
|
|
191
|
-
return (0, error_handler_1.createToolResult)(false, `Unexpected error: ${error.message}`, error);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
exports.GeminiDescribeVideoTool = GeminiDescribeVideoTool;
|
|
196
|
-
//# sourceMappingURL=gemini-describe-video.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-describe-video.js","sourceRoot":"","sources":["../../src/tools/gemini-describe-video.ts"],"names":[],"mappings":";;;;;;AAEA,0DAAoE;AACpE,6DAAqC;AAiCrC,MAAa,uBAAuB;IACd;IAApB,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAEpD,aAAa;QACX,OAAO;YACL,IAAI,EAAE,uBAAuB;YAC7B,WAAW,EAAE,0MAA0M;YACvN,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,GAAG,EAAE;wBACH,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,wBAAwB;qBACtC;oBACD,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,eAAe,CAAC;wBAC5C,OAAO,EAAE,UAAU;wBACnB,WAAW,EAAE,oHAAoH;qBAClI;oBACD,kBAAkB,EAAE;wBAClB,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,IAAI;wBACb,WAAW,EAAE,2GAA2G;qBACzH;oBACD,kBAAkB,EAAE;wBAClB,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,IAAI;wBACb,WAAW,EAAE,4DAA4D;qBAC1E;oBACD,aAAa,EAAE;wBACb,IAAI,EAA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