Below is the declaration of the function
$functions = [
'local_sociogram_get_graphs' => [
'classname' => 'local_sociogram\external\get_graphs',
'description' => 'obtener grafos.',
'type' => 'read',
'ajax' => true,
'services' => [
'local_sociogram_get_graphs',
],
'capabilities' =>'local/sociogram:vergrafo',
],
];