summaryrefslogtreecommitdiff
path: root/src/mcp/tools/common/common.h
blob: 0dedca88bc99bd114b562a1cec81c369c90bfea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef TINY_CONVMEM_MCP_TOOLS_COMMON_H
#define TINY_CONVMEM_MCP_TOOLS_COMMON_H

#include "domain/message.h"
#include "mcp/json.h"
#include "domain/message.h"
#include <mcpc/mcpc.h>

void tiny_mcp_tool_add_error(mcpc_ucbr_t *result, const char *code, const char *message);
void tiny_mcp_tool_add_json(mcpc_ucbr_t *result, tiny_json_buffer_t *json);
char *tiny_mcp_tool_get_string(const mcpc_tool_t *tool, const char *name, size_t maximum);
void tiny_mcp_tool_append_message(tiny_json_buffer_t *json, const tiny_message_t *message);
typedef enum tiny_metadata_parse_status
{
  TINY_METADATA_PARSE_OK = 0,
  TINY_METADATA_PARSE_INVALID,
  TINY_METADATA_PARSE_NO_MEMORY
} tiny_metadata_parse_status_t;

tiny_metadata_parse_status_t tiny_mcp_parse_metadata(const char *json,
                                                     tiny_message_t *message,
                                                     tiny_metadata_mask_t *present,
                                                     const char **error);

mcpc_tool_t *tiny_mcp_tool_new(const char *name, const char *description, mcpc_tcallcb_t callback);
bool tiny_mcp_tool_add_property(mcpc_tool_t *tool,
                                const char *name,
                                const char *description,
                                mcpc_anytype_t type,
                                bool required);

#endif