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}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
return await response.json() as T;
|
||||
} catch (error) {
|
||||
console.error(`Error en petición a ${endpoint}:`, error);
|
||||
throw error;
|
||||
@@ -123,7 +123,9 @@ server.registerTool(
|
||||
inputSchema: {
|
||||
card_id: z.number().describe('ID de la card'),
|
||||
},
|
||||
outputSchema: z.any()
|
||||
outputSchema: {
|
||||
result: z.any()
|
||||
}
|
||||
},
|
||||
async ({ card_id }) => {
|
||||
try {
|
||||
@@ -156,7 +158,9 @@ server.registerTool(
|
||||
value: z.any().describe('Valor del parámetro'),
|
||||
})).optional().describe('Parámetros para la query'),
|
||||
},
|
||||
outputSchema: z.any()
|
||||
outputSchema: {
|
||||
result: z.any()
|
||||
}
|
||||
},
|
||||
async ({ card_id, parameters }) => {
|
||||
try {
|
||||
@@ -206,7 +210,9 @@ server.registerTool(
|
||||
visualization_settings: z.record(z.any()).optional().describe('Configuración de visualizació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 }) => {
|
||||
try {
|
||||
@@ -255,7 +261,9 @@ server.registerTool(
|
||||
name: z.string().optional().describe('Nuevo nombre'),
|
||||
description: z.string().optional().describe('Nueva descripción'),
|
||||
},
|
||||
outputSchema: z.any()
|
||||
outputSchema: {
|
||||
result: z.any()
|
||||
}
|
||||
},
|
||||
async ({ card_id, name, description }) => {
|
||||
try {
|
||||
@@ -293,7 +301,9 @@ server.registerTool(
|
||||
title: 'Listar Colecciones',
|
||||
description: 'Lista todas las colecciones disponibles en Metabase',
|
||||
inputSchema: {},
|
||||
outputSchema: z.array(z.any())
|
||||
outputSchema: {
|
||||
collections: z.array(z.any())
|
||||
}
|
||||
},
|
||||
async () => {
|
||||
try {
|
||||
@@ -321,7 +331,9 @@ server.registerTool(
|
||||
inputSchema: {
|
||||
include_tables: z.boolean().optional().default(false).describe('Incluir metadata de tablas'),
|
||||
},
|
||||
outputSchema: z.any()
|
||||
outputSchema: {
|
||||
databases: z.array(z.any())
|
||||
}
|
||||
},
|
||||
async ({ include_tables }) => {
|
||||
try {
|
||||
@@ -366,7 +378,9 @@ server.registerTool(
|
||||
title: 'Listar Dashboards',
|
||||
description: 'Lista todos los dashboards disponibles',
|
||||
inputSchema: {},
|
||||
outputSchema: z.array(z.any())
|
||||
outputSchema: {
|
||||
dashboards: z.array(z.any())
|
||||
}
|
||||
},
|
||||
async () => {
|
||||
try {
|
||||
@@ -394,7 +408,9 @@ server.registerTool(
|
||||
inputSchema: {
|
||||
dashboard_id: z.number().describe('ID del dashboard'),
|
||||
},
|
||||
outputSchema: z.any()
|
||||
outputSchema: {
|
||||
result: z.any()
|
||||
}
|
||||
},
|
||||
async ({ dashboard_id }) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user