@netoalmanca/advpl-sensei 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -90,16 +90,25 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
90
90
|
const name = file.replace(".md", "");
|
|
91
91
|
const content = await fs.readFile(path.join(commandsDir, file), "utf-8");
|
|
92
92
|
const { metadata } = parseFrontmatter(content);
|
|
93
|
+
const rawParams = metadata.parameters || undefined;
|
|
94
|
+
const properties = {};
|
|
95
|
+
if (rawParams) {
|
|
96
|
+
for (const [k, v] of Object.entries(rawParams)) {
|
|
97
|
+
const { required: _req, ...rest } = v;
|
|
98
|
+
properties[k] = rest;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const defaultProperties = {
|
|
102
|
+
prompt: { type: "string", description: "O prompt ou instrução para o comando" },
|
|
103
|
+
args: { type: "string", description: "Argumentos adicionais (opcional)" },
|
|
104
|
+
};
|
|
93
105
|
tools.push({
|
|
94
106
|
name: `advpl_${name}`,
|
|
95
107
|
description: metadata.description || `Command ${name}`,
|
|
96
108
|
inputSchema: {
|
|
97
109
|
type: "object",
|
|
98
|
-
properties:
|
|
99
|
-
|
|
100
|
-
args: { type: "string", description: "Argumentos adicionais (opcional)" },
|
|
101
|
-
},
|
|
102
|
-
required: metadata.parameters ? Object.keys(metadata.parameters).filter(k => metadata.parameters[k].required !== false) : ["prompt"],
|
|
110
|
+
properties: rawParams ? properties : defaultProperties,
|
|
111
|
+
required: rawParams ? Object.keys(rawParams).filter(k => rawParams[k].required !== false) : ["prompt"],
|
|
103
112
|
},
|
|
104
113
|
});
|
|
105
114
|
}
|
|
@@ -216,6 +225,7 @@ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
|
216
225
|
});
|
|
217
226
|
async function main() {
|
|
218
227
|
const transport = new StdioServerTransport();
|
|
228
|
+
console.log(`MCP server 'advpl-sensei' iniciado — aguardando conexão via stdin/stdout...`);
|
|
219
229
|
await server.connect(transport);
|
|
220
230
|
}
|
|
221
231
|
main().catch((err) => {
|