feat(mcp): tools de idiomas y traducciones
- Nueva categoria tools/languages: list_web_languages, get_record_translations y set_record_translations (registros, config, textos_generales y vars de modulo via builder_custom). - Param lang opcional en list_table_records y get_record (options.translates de CocoDB). - Docs actualizados (03/04/06/09/11b + ACAI_ENDPOINTS) con el modelo de cms_traducciones y los workflows de traduccion.
This commit is contained in:
@@ -15,9 +15,10 @@ export function registerListTableRecordsTool(server) {
|
||||
limit: z.number().optional().describe("Max records to return. Default: 50. Use 5-10 for previews, up to 200 max for large exports."),
|
||||
fields: z.array(z.string()).optional().describe("Return only these columns (e.g., ['num', 'titulo', 'precio']). Omit to return all columns. Always include 'num' if you need record IDs."),
|
||||
truncateText: z.number().optional().describe("Truncate string field values longer than this many chars. Appends '... [truncated, N chars]'. Combine with 'fields' for maximum token savings."),
|
||||
lang: z.string().optional().describe("Language prefix (e.g. 'en'). Returns translated values for translatable fields"),
|
||||
}),
|
||||
{ readOnlyHint: true, destructiveHint: false },
|
||||
withAuth(async ({ tableName, page, where, limit, fields, truncateText }, extra) => {
|
||||
withAuth(async ({ tableName, page, where, limit, fields, truncateText, lang }, extra) => {
|
||||
try {
|
||||
// Validate required parameters
|
||||
const validationError = validateRequired({ tableName }, ['tableName'], 'list_table_records');
|
||||
@@ -33,6 +34,11 @@ export function registerListTableRecordsTool(server) {
|
||||
options: {}
|
||||
};
|
||||
|
||||
// Si se pide un idioma, el motor CocoDB aplica la traduccion en lectura.
|
||||
if (lang) {
|
||||
payload.options.translates = lang;
|
||||
}
|
||||
|
||||
// Send to CMS API via viewer_functions
|
||||
const response = await AcaiHttpClient.postCmsApi(
|
||||
credentials,
|
||||
|
||||
Reference in New Issue
Block a user