@iconicompany/imcp 0.1.0 → 0.2.0
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/README.md +5 -0
- package/package.json +1 -1
- package/src/service.ts +1 -0
- package/src/tool.ts +2 -0
package/README.md
CHANGED
|
@@ -34,6 +34,8 @@ const mcp = createMcpService({
|
|
|
34
34
|
description: "Статус заказа организации вызывающего",
|
|
35
35
|
input: z.object({ orderId: z.string() }),
|
|
36
36
|
readOnly: true,
|
|
37
|
+
// `_meta` в tools/list: признак клиента, например допуск во встроенный чат iagent.
|
|
38
|
+
meta: { "com.iconicompany.iagent/embed": true },
|
|
37
39
|
handler: async ({ orderId }, { caller }) => {
|
|
38
40
|
const order = await orders.find(caller.orgId, orderId);
|
|
39
41
|
if (!order) throw new ToolRefusal("Заказ не найден");
|
|
@@ -80,6 +82,9 @@ for (const p of mcp.paths.all) app.all(p, ({ request }) => mcp.fetch(request));
|
|
|
80
82
|
- `throw new ToolRefusal("текст")` — отказ модели с этим текстом. Любая другая ошибка уходит модели общим
|
|
81
83
|
текстом, в журнал — только её класс (`internal: Error`): в сообщениях бывают персональные данные.
|
|
82
84
|
- `role` у инструмента — инструмент виден только с этой ролью.
|
|
85
|
+
- `readOnly: true` — `annotations.readOnlyHint`; без него клиент считает инструмент пишущим (умолчание MCP).
|
|
86
|
+
- `meta` — `_meta` инструмента в `tools/list`, ключ — обратный домен. Встроенный чат iagent берёт инструмент
|
|
87
|
+
только с `meta: { "com.iconicompany.iagent/embed": true }` и `readOnly: true`.
|
|
83
88
|
|
|
84
89
|
## Журнал
|
|
85
90
|
|
package/package.json
CHANGED
package/src/service.ts
CHANGED
|
@@ -138,6 +138,7 @@ export function createMcpService(options: McpServiceOptions) {
|
|
|
138
138
|
description: tool.description,
|
|
139
139
|
inputSchema: tool.input,
|
|
140
140
|
...(tool.readOnly !== undefined && { annotations: { readOnlyHint: tool.readOnly } }),
|
|
141
|
+
...(tool.meta && { _meta: { ...tool.meta } }),
|
|
141
142
|
},
|
|
142
143
|
async (args: unknown) => {
|
|
143
144
|
const started = performance.now();
|
package/src/tool.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface ToolDefinition<S extends z.ZodObject = z.ZodObject> {
|
|
|
27
27
|
input: S;
|
|
28
28
|
/** Только чтение — подсказка клиенту (`readOnlyHint`). */
|
|
29
29
|
readOnly?: boolean;
|
|
30
|
+
/** `_meta` инструмента в `tools/list`: признаки клиентов (ключ — обратный домен, `com.iconicompany.iagent/embed`). */
|
|
31
|
+
meta?: Record<string, unknown>;
|
|
30
32
|
/** Роль проекта сверх роли сервиса; без неё инструмента в списке нет. */
|
|
31
33
|
role?: string;
|
|
32
34
|
handler: (args: z.infer<S>, ctx: ToolContext) => Promise<ToolReturn> | ToolReturn;
|