mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
added mcp tests for media
This commit is contained in:
@@ -177,7 +177,6 @@ export class SchemaObject<Schema extends TSchema = TSchema> {
|
||||
|
||||
this.throwIfRestricted(partial);
|
||||
|
||||
// overwrite arrays and primitives, only deep merge objects
|
||||
// @ts-ignore
|
||||
const config = set(current, path, value);
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ export function buildMediaSchema() {
|
||||
},
|
||||
{ default: {} },
|
||||
),
|
||||
// @todo: currently cannot be updated partially using mcp
|
||||
adapter: $schema(
|
||||
"config_media_adapter",
|
||||
s.anyOf(Object.values(adapterSchemaObject)),
|
||||
|
||||
@@ -50,12 +50,28 @@ export const $schema = <
|
||||
{
|
||||
...mcp.getToolOptions("update"),
|
||||
inputSchema: s.strictObject({
|
||||
full: s.boolean({ default: false }).optional(),
|
||||
value: schema as any,
|
||||
return_config: s.boolean({ default: false }).optional(),
|
||||
secrets: s.boolean({ default: false }).optional(),
|
||||
}),
|
||||
},
|
||||
async (params, ctx: AppToolHandlerCtx) => {
|
||||
return ctx.json(params);
|
||||
const { value, return_config, secrets } = params;
|
||||
const [module_name, ...rest] = node.instancePath;
|
||||
|
||||
await ctx.context.app.mutateConfig(module_name as any).overwrite(rest, value);
|
||||
|
||||
let config: any = undefined;
|
||||
if (return_config) {
|
||||
const configs = ctx.context.app.toJSON(secrets);
|
||||
config = getPath(configs, node.instancePath);
|
||||
}
|
||||
|
||||
return ctx.json({
|
||||
success: true,
|
||||
module: module_name,
|
||||
config,
|
||||
});
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user