Skip to content

Commit 98835fe

Browse files
committed
Adding MCP Tools
1 parent e1b4ee3 commit 98835fe

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

provider/modelcontextprotocoltools/index.test.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,26 @@ describe('Module exports', () => {
6161
// } catch (error) {
6262
// console.log('Validation error:', error);
6363
// }
64-
6564
// // While we can't test types directly, we can verify the module has exports
6665
// // expect(mentions.length).toBeGreaterThan(0)
6766
// })
6867

6968
test('exports me type definitions', async () => {
7069
// We can't directly test types at runtime, but we can verify the exports exist
71-
const client = await proxy.meta!( { 'mcp.provider.uri': 'file:///Users/arafatkhan/Desktop/servers/src/everything/dist/index.js' , 'mcp.provider.args': [] })
70+
const client = await proxy.meta!( {}, { 'mcp.provider.uri': 'file:///Users/arafatkhan/Desktop/servers/src/everything/dist/index.js' , 'mcp.provider.args': [] })
7271
console.log(client)
73-
const inputs = await proxy.mentions!({ query: 'add' }, {})
74-
const inputSchema = JSON.parse((inputs[0] as any).inputSchema)
75-
console.log(inputSchema)
72+
const inputs = await proxy.mentions!({ query: '' }, {})
73+
console.log("inputs response is :", inputs[0].data)
74+
const inputSchema = inputs[0].data
75+
console.log("inputSchema is :", inputSchema)
7676
const ajv = new Ajv();
7777
const validInput = {
78-
a: 2,
79-
b: 3
78+
message: "hello"
8079
};
8180
const isValidInput = ajv.validate(inputSchema, validInput);
8281
console.log('Valid input:', isValidInput, validInput);
8382

84-
const items = await proxy.items!({ mention: { uri: 'test', title: 'add', data: { a: 2, b: 3 } } }, {})
83+
const items = await proxy.items!({ mention: { uri: 'test', title: 'echo', data: { message: 'hello' } } }, {})
8584
console.log(items)
8685

8786

provider/modelcontextprotocoltools/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type {
1414
Mention,
1515
MentionsParams,
1616
MentionsResult,
17+
MetaParams,
1718
MetaResult,
1819
Provider,
1920
ProviderSettings,
@@ -60,7 +61,7 @@ class MCPToolsProxy implements Provider {
6061
private toolSchemas: Map<string, any> = new Map()
6162
private ajv = new Ajv()
6263

63-
async meta(settings: ProviderSettings): Promise<MetaResult> {
64+
async meta(_params: MetaParams, settings: ProviderSettings): Promise<MetaResult> {
6465
const nodeCommand: string = (settings.nodeCommand as string) ?? 'node'
6566
const mcpProviderUri = settings['mcp.provider.uri'] as string
6667
if (!mcpProviderUri) {
@@ -88,6 +89,7 @@ class MCPToolsProxy implements Provider {
8889
},
8990
}
9091
}
92+
9193
async mentions?(params: MentionsParams, _settings: ProviderSettings): Promise<MentionsResult> {
9294
if (!this.mcpClient) {
9395
return []
@@ -105,7 +107,7 @@ class MCPToolsProxy implements Provider {
105107
uri: tool.uri,
106108
title: tool.name,
107109
description: tool.description,
108-
inputSchema: JSON.stringify(tool.inputSchema),
110+
data: (tool.inputSchema),
109111
} as Mention
110112
mentions.push(r)
111113
}

0 commit comments

Comments
 (0)