Corregir outputSchema en todas las herramientas MCP
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 14s
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 14s
- Cambiar z.any() a { result: z.any() }
- Cambiar z.array(z.any()) a { collections/databases/dashboards: z.array(z.any()) }
- Agregar type assertion 'as T' en metabaseFetch
- Soluciona errores de TypeScript con ZodRawShape
This commit is contained in:
@@ -40,7 +40,7 @@ async function metabaseFetch<T = any>(
|
|||||||
throw new Error(`Metabase API error (${response.status}): ${errorText}`);
|
throw new Error(`Metabase API error (${response.status}): ${errorText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await response.json();
|
return await response.json() as T;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error en petición a ${endpoint}:`, error);
|
console.error(`Error en petición a ${endpoint}:`, error);
|
||||||
throw error;
|
throw error;
|
||||||
@@ -123,7 +123,9 @@ server.registerTool(
|
|||||||
inputSchema: {
|
inputSchema: {
|
||||||
card_id: z.number().describe('ID de la card'),
|
card_id: z.number().describe('ID de la card'),
|
||||||
},
|
},
|
||||||
outputSchema: z.any()
|
outputSchema: {
|
||||||
|
result: z.any()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async ({ card_id }) => {
|
async ({ card_id }) => {
|
||||||
try {
|
try {
|
||||||
@@ -156,7 +158,9 @@ server.registerTool(
|
|||||||
value: z.any().describe('Valor del parámetro'),
|
value: z.any().describe('Valor del parámetro'),
|
||||||
})).optional().describe('Parámetros para la query'),
|
})).optional().describe('Parámetros para la query'),
|
||||||
},
|
},
|
||||||
outputSchema: z.any()
|
outputSchema: {
|
||||||
|
result: z.any()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async ({ card_id, parameters }) => {
|
async ({ card_id, parameters }) => {
|
||||||
try {
|
try {
|
||||||
@@ -206,7 +210,9 @@ server.registerTool(
|
|||||||
visualization_settings: z.record(z.any()).optional().describe('Configuración de visualización'),
|
visualization_settings: z.record(z.any()).optional().describe('Configuración de visualización'),
|
||||||
collection_id: z.number().optional().describe('ID de la colección'),
|
collection_id: z.number().optional().describe('ID de la colección'),
|
||||||
},
|
},
|
||||||
outputSchema: z.any()
|
outputSchema: {
|
||||||
|
result: z.any()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async ({ name, description, dataset_query, display, visualization_settings, collection_id }) => {
|
async ({ name, description, dataset_query, display, visualization_settings, collection_id }) => {
|
||||||
try {
|
try {
|
||||||
@@ -255,7 +261,9 @@ server.registerTool(
|
|||||||
name: z.string().optional().describe('Nuevo nombre'),
|
name: z.string().optional().describe('Nuevo nombre'),
|
||||||
description: z.string().optional().describe('Nueva descripción'),
|
description: z.string().optional().describe('Nueva descripción'),
|
||||||
},
|
},
|
||||||
outputSchema: z.any()
|
outputSchema: {
|
||||||
|
result: z.any()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async ({ card_id, name, description }) => {
|
async ({ card_id, name, description }) => {
|
||||||
try {
|
try {
|
||||||
@@ -293,7 +301,9 @@ server.registerTool(
|
|||||||
title: 'Listar Colecciones',
|
title: 'Listar Colecciones',
|
||||||
description: 'Lista todas las colecciones disponibles en Metabase',
|
description: 'Lista todas las colecciones disponibles en Metabase',
|
||||||
inputSchema: {},
|
inputSchema: {},
|
||||||
outputSchema: z.array(z.any())
|
outputSchema: {
|
||||||
|
collections: z.array(z.any())
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
try {
|
try {
|
||||||
@@ -321,7 +331,9 @@ server.registerTool(
|
|||||||
inputSchema: {
|
inputSchema: {
|
||||||
include_tables: z.boolean().optional().default(false).describe('Incluir metadata de tablas'),
|
include_tables: z.boolean().optional().default(false).describe('Incluir metadata de tablas'),
|
||||||
},
|
},
|
||||||
outputSchema: z.any()
|
outputSchema: {
|
||||||
|
databases: z.array(z.any())
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async ({ include_tables }) => {
|
async ({ include_tables }) => {
|
||||||
try {
|
try {
|
||||||
@@ -366,7 +378,9 @@ server.registerTool(
|
|||||||
title: 'Listar Dashboards',
|
title: 'Listar Dashboards',
|
||||||
description: 'Lista todos los dashboards disponibles',
|
description: 'Lista todos los dashboards disponibles',
|
||||||
inputSchema: {},
|
inputSchema: {},
|
||||||
outputSchema: z.array(z.any())
|
outputSchema: {
|
||||||
|
dashboards: z.array(z.any())
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
try {
|
try {
|
||||||
@@ -394,7 +408,9 @@ server.registerTool(
|
|||||||
inputSchema: {
|
inputSchema: {
|
||||||
dashboard_id: z.number().describe('ID del dashboard'),
|
dashboard_id: z.number().describe('ID del dashboard'),
|
||||||
},
|
},
|
||||||
outputSchema: z.any()
|
outputSchema: {
|
||||||
|
result: z.any()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async ({ dashboard_id }) => {
|
async ({ dashboard_id }) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user