77#ifndef ZEPHYR_INCLUDE_NET_MCP_SERVER_H_
88#define ZEPHYR_INCLUDE_NET_MCP_SERVER_H_
99
10+ /**
11+ * @file
12+ * @brief Model Context Protocol (MCP) Server API
13+ */
14+
1015#include <zephyr/kernel.h>
1116#include <errno.h>
1217
@@ -15,6 +20,9 @@ extern "C" {
1520#endif
1621
1722#ifdef CONFIG_MCP_TOOLS_CAPABILITY
23+ /**
24+ * @brief Tool metadata structure
25+ */
1826typedef struct mcp_tool_metadata {
1927 char name [CONFIG_MCP_TOOL_NAME_MAX_LEN ];
2028 char input_schema [CONFIG_MCP_TOOL_SCHEMA_MAX_LEN ];
@@ -29,10 +37,18 @@ typedef struct mcp_tool_metadata {
2937#endif
3038} mcp_tool_metadata_t ;
3139
32- /* Tool callback function signature */
40+ /**
41+ * @brief Tool callback function
42+ *
43+ * @param params JSON string with tool parameters
44+ * @param execution_token Unique execution identifier
45+ * @return 0 on success, negative errno on failure
46+ */
3347typedef int (* mcp_tool_callback_t )(const char * params , uint32_t execution_token );
3448
35- /* Tool definition structure */
49+ /**
50+ * @brief Tool definition structure
51+ */
3652typedef struct mcp_tool_record {
3753 mcp_tool_metadata_t metadata ;
3854 mcp_tool_callback_t callback ;
@@ -41,50 +57,48 @@ typedef struct mcp_tool_record {
4157
4258struct mcp_message_msg {
4359 uint32_t token ;
44- /* More fields will be added later */
4560};
4661
4762/**
48- * @brief Initialize the MCP Server.
63+ * @brief Initialize the MCP Server
4964 *
50- * @return 0 on success, negative errno code on failure
65+ * @return 0 on success, negative errno on failure
5166 */
5267int mcp_server_init (void );
5368
5469/**
55- * @brief Start the MCP Server.
70+ * @brief Start the MCP Server
5671 *
57- * @return 0 on success, negative errno code on failure
72+ * @return 0 on success, negative errno on failure
5873 */
5974int mcp_server_start (void );
6075
6176/**
62- * @brief Queues a response to the MCP Server library, which takes care of sending it to
63- * the MCP Client.
77+ * @brief Queue a response for delivery
6478 *
65- * @return 0 on success, negative errno code on failure
79+ * @return 0 on success, negative errno on failure
6680 */
6781int mcp_queue_response (void );
6882
6983#ifdef CONFIG_MCP_TOOLS_CAPABILITY
7084/**
71- * @brief Add a tool to the MCP server tool registry
85+ * @brief Add a tool to the server
7286 *
73- * @param tool_record Pointer to tool record containing metadata and callback
74- * @return 0 on success, negative errno code on failure
75- * -EINVAL if tool_record is NULL or invalid
76- * -EEXIST if tool with same name already exists
77- * -ENOSPC if tool registry is full
87+ * @param tool_record Tool definition with metadata and callback
88+ * @return 0 on success, negative errno on failure
89+ * @retval -EINVAL Invalid tool_record
90+ * @retval -EEXIST Tool name already exists
91+ * @retval -ENOSPC Registry full
7892 */
7993int mcp_server_add_tool (const mcp_tool_record_t * tool_record );
8094
8195/**
82- * @brief Remove a tool from the MCP server tool registry
96+ * @brief Remove a tool from the server
8397 *
84- * @param tool_name Name of the tool to remove
85- * @return 0 on success, negative errno code on failure
86- * -EINVAL if tool_name is NULL
87- * -ENOENT if tool not found
98+ * @param tool_name Name of tool to remove
99+ * @return 0 on success, negative errno on failure
100+ * @retval -EINVAL Invalid tool name
101+ * @retval -ENOENT Tool not found
88102 */
89103int mcp_server_remove_tool (const char * tool_name );
90104#endif
0 commit comments