Converte símbolos Unicode decorativos dos comentários para ASCII
Substitui barras de caixa (─ ═ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴), travessões (—), setas (→ ←), reticências (…), bullets (•), multiplicação (×) e guillemets (› ‹) por equivalentes ASCII. Acentos portugueses são preservados.
This commit is contained in:
1 parent
1cc0ff9d02
commit
90d47bf8a0
36 files changed
+327
-327
No files matched your search
+13
-13
@@ -1,29 +1,29 @@
|
||||
/*
|
||||
* mcp.c — Plugin TinyBlocks com blocos MCP (Model Context Protocol).
|
||||
* mcp.c - Plugin TinyBlocks com blocos MCP (Model Context Protocol).
|
||||
*
|
||||
* Blocos:
|
||||
* MCP.Server — literal: armazena a URL do servidor MCP
|
||||
* MCP.Server - literal: armazena a URL do servidor MCP
|
||||
* HTTP: "http://localhost:3000/mcp"
|
||||
* stdio: "stdio://npx @modelcontextprotocol/server-filesystem /tmp"
|
||||
*
|
||||
* MCP.Ping — input: url (text) → output: status (text)
|
||||
* MCP.Ping - input: url (text) -> output: status (text)
|
||||
* Verifica se o servidor responde.
|
||||
*
|
||||
* MCP.ListTools — input: url (text) → output: tools (text)
|
||||
* MCP.ListTools - input: url (text) -> output: tools (text)
|
||||
* Lista ferramentas disponíveis no servidor.
|
||||
*
|
||||
* MCP.Call — inputs: url, tool, args (text) → output: result (text)
|
||||
* MCP.Call - inputs: url, tool, args (text) -> output: result (text)
|
||||
* Chama uma ferramenta com argumentos JSON.
|
||||
*
|
||||
* Compilar:
|
||||
* make mcp-lib
|
||||
*
|
||||
* Carregar no editor:
|
||||
* ./build/editor build/mcp.so ou Ctrl+O → build/mcp.so
|
||||
* ./build/editor build/mcp.so ou Ctrl+O -> build/mcp.so
|
||||
*
|
||||
* Exemplo de uso no editor:
|
||||
* [Literal.Text "stdio://npx @modelcontextprotocol/server-filesystem /tmp"]
|
||||
* → [MCP.ListTools] → [IO.Print "tools"]
|
||||
* -> [MCP.ListTools] -> [IO.Print "tools"]
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
@@ -32,13 +32,13 @@
|
||||
#include <tinyblocks/tinyblocks.h>
|
||||
#include <tinyblocks-mcp/tb_mcp.h>
|
||||
|
||||
/* ── Helper: lê texto de slot ────────────────────────────────────────────── */
|
||||
/* -- Helper: lê texto de slot --- */
|
||||
static const char* gs(TinyBlocks_Block* self, TinyBlocks* rt, uint32_t idx) {
|
||||
TinyBlocks_Value v = tb_block_get_input(self, rt, idx);
|
||||
return (v.kind == TB_VALUE_TEXT && v.as.text) ? v.as.text : "";
|
||||
}
|
||||
|
||||
/* ── MCP.Ping ────────────────────────────────────────────────────────────── */
|
||||
/* -- MCP.Ping --- */
|
||||
static void eval_mcp_ping(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
const char* url = gs(self, rt, 0);
|
||||
char* result = tb_mcp_ping(url);
|
||||
@@ -47,7 +47,7 @@ static void eval_mcp_ping(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
self->dirty = false;
|
||||
}
|
||||
|
||||
/* ── MCP.ListTools ───────────────────────────────────────────────────────── */
|
||||
/* -- MCP.ListTools --- */
|
||||
static void eval_mcp_list_tools(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
const char* url = gs(self, rt, 0);
|
||||
char* result = tb_mcp_list_tools(url);
|
||||
@@ -56,7 +56,7 @@ static void eval_mcp_list_tools(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
self->dirty = false;
|
||||
}
|
||||
|
||||
/* ── MCP.Call ────────────────────────────────────────────────────────────── */
|
||||
/* -- MCP.Call --- */
|
||||
static void eval_mcp_call(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
const char* url = gs(self, rt, 0);
|
||||
const char* tool = gs(self, rt, 1);
|
||||
@@ -67,7 +67,7 @@ static void eval_mcp_call(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
self->dirty = false;
|
||||
}
|
||||
|
||||
/* ── Slots ───────────────────────────────────────────────────────────────── */
|
||||
/* -- Slots --- */
|
||||
static const TinyBlocks_SlotDesc url_in[] = {{"url", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc call_in[] = {{"url", TB_VALUE_TEXT},
|
||||
{"tool", TB_VALUE_TEXT},
|
||||
@@ -76,7 +76,7 @@ static const TinyBlocks_SlotDesc status_out[] = {{"status", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc tools_out[] = {{"tools", TB_VALUE_TEXT}};
|
||||
static const TinyBlocks_SlotDesc result_out[] = {{"result", TB_VALUE_TEXT}};
|
||||
|
||||
/* ── Registro ────────────────────────────────────────────────────────────── */
|
||||
/* -- Registro --- */
|
||||
static bool mcp_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
if (!tb_mcp_init()) return false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user