upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/main/mcp_handler.h
blob: 09aab9fd9b0286a8009172c568bde9f412b7c8f6 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef MCP_HANDLER_H
#define MCP_HANDLER_H

#include <stdint.h>
#include <stdbool.h>

typedef enum {
    MCP_TOOL_GET_CONFIG = 0,
    MCP_TOOL_SET_CONFIG = 1,
    MCP_TOOL_GET_BALANCE = 2,
    MCP_TOOL_WALLET_SEND = 3,
    MCP_TOOL_GET_SESSIONS = 4,
    MCP_TOOL_GET_USAGE = 5,
    MCP_TOOL_SET_PAYOUT = 6,
    MCP_TOOL_SET_METRIC = 7,
    MCP_TOOL_SET_PRICE = 8,
    MCP_TOOL_WALLET_MELT = 9,
    MCP_TOOL_UNKNOWN = 99
} mcp_tool_t;

typedef struct {
    mcp_tool_t tool;
    char method[64];
    char params_json[1024];
} mcp_request_t;

typedef struct {
    bool success;
    char result_json[2048];
    char error[256];
} mcp_response_t;

mcp_tool_t mcp_parse_tool(const char *method);

mcp_response_t mcp_handle_get_config(void);
mcp_response_t mcp_handle_set_config(const char *params_json);
mcp_response_t mcp_handle_get_balance(void);
mcp_response_t mcp_handle_wallet_send(const char *params_json);
mcp_response_t mcp_handle_get_sessions(void);
mcp_response_t mcp_handle_get_usage(void);
mcp_response_t mcp_handle_set_payout(const char *params_json);
mcp_response_t mcp_handle_set_metric(const char *params_json);
mcp_response_t mcp_handle_set_price(const char *params_json);
mcp_response_t mcp_handle_wallet_melt(const char *params_json);

mcp_response_t mcp_dispatch(const mcp_request_t *req);

#endif