Oopenvela-robotInitial commit
87624305创建于 4月11日历史提交
/*
 * Copyright (C) 2026 Xiaomi Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <stddef.h>
#include <stdbool.h>
#include "tools/mcp_server.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Tool handler: returns heap-allocated JSON string (caller frees) */
typedef char* (*mcp_tool_handler_t)(const char *args_json, void *user_data);

int   mcp_tool_registry_init(void);
int   mcp_tool_registry_register(const char *name, const char *description,
                                  const mcp_param_t *params, size_t param_count,
                                  mcp_tool_handler_t handler, void *user_data);
char *mcp_tool_registry_get_tools_json(void);
char *mcp_tool_registry_execute_tool(const char *name, const char *args_json);
void  mcp_tool_registry_cleanup(void);

#ifdef __cplusplus
}
#endif