executeImpl method
Implement the actual tool logic
params are the validated parameters (never null here)
Returns the result data to send in the response
Implementation
@override
Future<dynamic> executeImpl(Map<String, dynamic> params) async {
final skillName = params['skill_name'] as String;
final category = params['category'] as String? ?? 'serverpod';
// Get project to locate skills directory
final project = ServerPodLocator.getProject();
// Try to find the skill file
final skillFile = await _findSkillFile(
skillName,
category,
project?.rootPath,
);
if (skillFile == null) {
return {
'error': 'Skill not found',
'message': 'Could not find skill "$skillName" in category "$category". '
'Available skills can be listed using the list_skills tool.',
'skill_name': skillName,
'category': category,
};
}
// Read skill content
final content = await skillFile.readAsString();
// Load metadata if available
final metadata = await _loadMetadata(skillFile);
// Extract template variables from the project context
final templateVars = await _extractTemplateVars(project);
return {
'name': skillName,
'category': category,
'content': content,
'metadata': metadata,
'template_vars': templateVars,
'path': skillFile.path,
};
}