- remove legacy contexts surfaces from the app, MCP bridge, standalone server, and docs - keep getContext and retrieveQueryContext while aligning the simplified graph-only contract - harden dev startup migration behavior and disable the accidental chat surface in open source Generated with Codex
38 lines
955 B
TypeScript
38 lines
955 B
TypeScript
import { tool } from 'ai';
|
|
import { z } from 'zod';
|
|
import { deleteSkill } from '@/services/skills/skillService';
|
|
import { eventBroadcaster } from '@/services/events';
|
|
|
|
export const deleteSkillTool = tool({
|
|
description: 'Delete a skill by name.',
|
|
inputSchema: z.object({
|
|
name: z.string().describe('The name of the skill to delete'),
|
|
}),
|
|
execute: async ({ name }) => {
|
|
try {
|
|
const result = deleteSkill(name);
|
|
if (!result.success) {
|
|
return {
|
|
success: false,
|
|
error: result.error,
|
|
data: null,
|
|
};
|
|
}
|
|
|
|
eventBroadcaster.broadcast({ type: 'GUIDE_UPDATED', data: { name } });
|
|
|
|
return {
|
|
success: true,
|
|
data: { name },
|
|
message: `Skill "${name}" deleted`,
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
success: false,
|
|
error: error instanceof Error ? error.message : 'Failed to delete skill',
|
|
data: null,
|
|
};
|
|
}
|
|
},
|
|
});
|