get_radios
Retrieve Colombian radio stations with streaming URLs, optionally filtered by city. Access broadcast frequencies and locations for listening.
Instructions
Obtiene la lista de emisoras de radio de Colombia. Puede filtrar por ciudad.
Args:
city_id (number, opcional): ID de la ciudad para filtrar
Returns: Lista de emisoras con nombre, frecuencia, ciudad y URL de streaming.
Ejemplo de uso:
"¿Qué emisoras de radio hay en Colombia?"
"Emisoras de radio en Bogotá"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city_id | No | ID de la ciudad para filtrar |
Implementation Reference
- src/index.ts:781-820 (handler)The handler function for the 'get_radios' tool. It fetches radio stations from the API endpoint '/Radio' or '/City/{city_id}/radios', limits to 50 results, formats them into a JSON structure with total count and station details (id, name, frequency, city, streaming URL), and returns as MCP content or error message.async ({ city_id }) => { try { let radios: any[]; if (city_id) { radios = await apiRequest<any[]>(`/City/${city_id}/radios`); } else { radios = await apiRequest<any[]>("/Radio"); } const resultado = { total: radios.length, emisoras: radios.slice(0, 50).map(r => ({ id: r.id, nombre: r.name, frecuencia: r.frequency, ciudad: r.city?.name || "N/A", url_streaming: r.streamingUrl, })), }; return { content: [ { type: "text", text: JSON.stringify(resultado, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error al obtener emisoras: ${error instanceof Error ? error.message : "Error desconocido"}`, }, ], }; } }
- src/index.ts:758-780 (schema)The tool specification including title, description, input schema (optional city_id as integer), and annotations for the 'get_radios' tool.{ title: "Obtener Emisoras de Radio", description: `Obtiene la lista de emisoras de radio de Colombia. Puede filtrar por ciudad. Args: - city_id (number, opcional): ID de la ciudad para filtrar Returns: Lista de emisoras con nombre, frecuencia, ciudad y URL de streaming. Ejemplo de uso: - "¿Qué emisoras de radio hay en Colombia?" - "Emisoras de radio en Bogotá"`, inputSchema: { city_id: z.number().int().optional().describe("ID de la ciudad para filtrar"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, },
- src/index.ts:756-821 (registration)The server.registerTool call that registers the 'get_radios' tool with its specification and inline handler function.server.registerTool( "get_radios", { title: "Obtener Emisoras de Radio", description: `Obtiene la lista de emisoras de radio de Colombia. Puede filtrar por ciudad. Args: - city_id (number, opcional): ID de la ciudad para filtrar Returns: Lista de emisoras con nombre, frecuencia, ciudad y URL de streaming. Ejemplo de uso: - "¿Qué emisoras de radio hay en Colombia?" - "Emisoras de radio en Bogotá"`, inputSchema: { city_id: z.number().int().optional().describe("ID de la ciudad para filtrar"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, async ({ city_id }) => { try { let radios: any[]; if (city_id) { radios = await apiRequest<any[]>(`/City/${city_id}/radios`); } else { radios = await apiRequest<any[]>("/Radio"); } const resultado = { total: radios.length, emisoras: radios.slice(0, 50).map(r => ({ id: r.id, nombre: r.name, frecuencia: r.frequency, ciudad: r.city?.name || "N/A", url_streaming: r.streamingUrl, })), }; return { content: [ { type: "text", text: JSON.stringify(resultado, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error al obtener emisoras: ${error instanceof Error ? error.message : "Error desconocido"}`, }, ], }; } } );