Skip to content

Commit 5e8d33c

Browse files
committed
Adds apps to return of tools
Signed-off-by: Marcos Candeia <[email protected]>
1 parent f4ecb5e commit 5e8d33c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@deco/mcp",
3-
"version": "0.3.9",
3+
"version": "0.4.0",
44
"exports": {
55
".": "./mod.ts",
66
"./http": "./mcp/http.ts"

mcp/server.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export interface Tool {
7272
name: string;
7373
icon?: string;
7474
resolveType: string;
75+
appName?: string;
7576
description: string;
7677
outputSchema: JSONSchema7;
7778
inputSchema: JSONSchema7;
@@ -81,6 +82,7 @@ export const getTools = <TManifest extends AppManifest>(
8182
toolNames: Map<string, string>,
8283
schemas?: Schemas,
8384
options?: Options<TManifest>,
85+
apps?: Record<string, { namespace: string }>,
8486
): Tool[] => {
8587
if (!schemas) return [];
8688

@@ -188,6 +190,7 @@ export const getTools = <TManifest extends AppManifest>(
188190
return {
189191
name: toolName,
190192
resolveType,
193+
appName: apps?.[resolveType]?.namespace,
191194
description: funcDefinition.description ?? inputSchema?.description ??
192195
resolveType,
193196
icon,
@@ -227,7 +230,14 @@ function registerTools<TManifest extends AppManifest>(
227230
const meta = await deco.meta().then((v) => v?.value);
228231
if (!meta) return { tools: [] };
229232
const schemas = meta.schema;
230-
return { tools: getTools(toolNames, schemas, options) };
233+
return {
234+
tools: getTools(
235+
toolNames,
236+
schemas,
237+
options,
238+
meta?.manifest?.blocks?.apps,
239+
),
240+
};
231241
};
232242

233243
const listTools: ListToolsMiddleware = compose(

0 commit comments

Comments
 (0)