get_videos
Retrieve a list of videos filtered by ID, title, or language, with pagination controls for skip and limit.
Instructions
Get a list of videos with optional filtering and pagination.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Filter videos by ID | |
| title | No | Filter videos by title | |
| language | No | Filter videos by language | |
| skip | No | Number of videos to skip | |
| limit | No | Maximum number of videos to return |
Implementation Reference
- src/tools/videos.ts:9-39 (handler)The MCP tool definition for 'get_videos' including the handler function that calls fetchVideos and formats the response as text.
export const getVideosTool = { name: TOOL_CONFIG.videos.name, description: TOOL_CONFIG.videos.description, parameters: { id: z.string().optional().describe('Filter videos by ID'), title: z.string().optional().describe('Filter videos by title'), language: z.string().optional().describe('Filter videos by language'), skip: z.number().optional().default(0).describe('Number of videos to skip'), limit: z.number().optional().default(10).describe('Maximum number of videos to return') }, handler: async (params: VideosParams): Promise<McpResponse> => { try { const result = await fetchVideos(params) if (!result.getVideos) { throw new Error('No results returned from API') } const content: McpTextContent = { type: 'text', text: `Videos Results:\n\n${JSON.stringify(result.getVideos, null, 2)}` } return { content: [content] } } catch (error) { throw new Error(`Failed to fetch videos: ${error.message}`) } } } - src/services/api.ts:206-241 (helper)The fetchVideos service function that executes the GraphQL query against the API to retrieve videos with optional filtering and pagination.
export async function fetchVideos (params: { id?: string; title?: string; language?: string; skip?: number; limit?: number; }): Promise<VideosResponse> { const { id, title, language, skip, limit } = params const languageCode = getLanguageCode(language) return await client.query({ getVideos: { __args: { _id: id, title, language: languageCode, skip, limit }, totalCount: true, retrieved: true, processedIn: true, videos: { _id: true, title: true, abstract: true, type: true, link: true, additionalLinks: true, tags: true, language: true, date: true } } }) as VideosResponse } - src/types/index.ts:73-80 (schema)Type definitions for VideosResponse (the GraphQL response shape) and Video (individual video fields).
export interface VideosResponse { getVideos: { totalCount: number; retrieved: number; processedIn: number; videos: Video[]; } | null; } - src/types/index.ts:109-115 (schema)VideosParams type definition for the input parameters accepted by the tool.
export interface VideosParams { id?: string; title?: string; language?: string; skip?: number; limit?: number; } - src/index.ts:36-41 (registration)Registration of the getVideosTool as an MCP server tool using server.tool().
server.tool( getVideosTool.name, getVideosTool.description, getVideosTool.parameters, getVideosTool.handler ) - src/config/api.ts:21-24 (registration)TOOL_CONFIG entry defining the tool name 'get_videos' and its description.
videos: { name: 'get_videos', description: 'Get a list of videos with optional filtering and pagination.' },