get_talks
Retrieve and filter Erick Wendel's talks by ID, title, language, location, or year, with options for pagination, grouping, and count-only queries.
Instructions
Get a list of talks with optional filtering and pagination.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | No | Filter talks by city | |
| count_only | No | If true, returns only the count without talk details | |
| country | No | Filter talks by country | |
| group_by | No | Group counts by a specific field (language, country, city) | |
| id | No | Filter talks by ID | |
| language | No | Filter talks by language (e.g., 'spanish', 'english', 'portuguese' or direct codes like 'es', 'en', 'pt-br') | |
| limit | No | Maximum number of talks to return | |
| skip | No | Number of talks to skip | |
| title | No | Filter talks by title | |
| year | No | Filter talks by year |
Implementation Reference
- src/tools/talks.ts:64-143 (handler)The async handler function that implements the core logic of the 'get_talks' tool. It processes input parameters, calls the API service to fetch talks, handles special cases like year filtering, count-only mode, grouping, pagination, and formats the MCP text response.handler: async (params: TalksParams): Promise<McpResponse> => { try { const { id, title, language, city, country, year, skip, limit, count_only, group_by } = params; // Handle year-specific filtering if (year) { const allTalks = await fetchTalksByYear({ id, title, language, city, country, year }); if (count_only) { let response = `Total talks in ${year}: ${allTalks.length}`; if (group_by) { const counts = calculateGroupCounts(allTalks, group_by); response += formatGroupCounts(counts, group_by); } const content: McpTextContent = { type: "text", text: response }; return { content: [content], }; } // Apply pagination to filtered results const paginatedTalks = allTalks.slice(skip || 0, (skip || 0) + (limit || 10)); const content: McpTextContent = { type: "text", text: `Talks Results for ${year}:\n\n${JSON.stringify({ totalCount: allTalks.length, retrieved: paginatedTalks.length, talks: paginatedTalks }, null, 2)}` }; return { content: [content], }; } // Regular query without year filtering const result = await fetchTalks({ id, title, language, city, country, skip, limit, count_only }); if (!result.getTalks) { throw new Error('No results returned from API'); } if (count_only) { let response = `Total talks: ${result.getTalks.totalCount}`; if (group_by && result.getTalks.talks) { const counts = calculateGroupCounts(result.getTalks.talks, group_by); response += formatGroupCounts(counts, group_by); } const content: McpTextContent = { type: "text", text: response }; return { content: [content], }; } const content: McpTextContent = { type: "text", text: `Talks Results:\n\n${JSON.stringify(result.getTalks, null, 2)}` }; return { content: [content], }; } catch (error) { throw new Error(`Failed to fetch talks: ${error.message}`); } }
- src/tools/talks.ts:52-63 (schema)Zod schema defining the input parameters for the 'get_talks' tool, including filters, pagination, and grouping options.parameters: { id: z.string().optional().describe("Filter talks by ID"), title: z.string().optional().describe("Filter talks by title"), language: z.string().optional().describe("Filter talks by language (e.g., 'spanish', 'english', 'portuguese' or direct codes like 'es', 'en', 'pt-br')"), city: z.string().optional().describe("Filter talks by city"), country: z.string().optional().describe("Filter talks by country"), year: z.number().optional().describe("Filter talks by year"), skip: z.number().optional().default(0).describe("Number of talks to skip"), limit: z.number().optional().default(10).describe("Maximum number of talks to return"), count_only: z.boolean().optional().default(false).describe("If true, returns only the count without talk details"), group_by: z.string().optional().describe("Group counts by a specific field (language, country, city)"), },
- src/index.ts:22-26 (registration)Registration of the 'get_talks' tool on the MCP server by calling server.tool() with its name, description, parameters, and handler.getTalksTool.name, getTalksTool.description, getTalksTool.parameters, getTalksTool.handler );
- src/config/api.ts:13-16 (schema)Configuration object providing the name and description for the 'get_talks' tool.talks: { name: "get_talks", description: "Get a list of talks with optional filtering and pagination." },
- src/tools/talks.ts:9-33 (helper)Helper function to calculate group counts by language, country, or city for talks, used in grouping feature.function calculateGroupCounts(talks: Talk[], groupBy: string): Map<string, number> { const counts = new Map<string, number>(); talks.forEach(talk => { if (!talk) return; let value = ''; switch(groupBy) { case 'language': value = talk.language || 'unknown'; break; case 'country': value = talk.location?.country || 'unknown'; break; case 'city': value = talk.location?.city || 'unknown'; break; default: return; } counts.set(value, (counts.get(value) || 0) + 1); }); return counts; }