fms-odata-mcp 0.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/LICENSE +21 -0
- package/README.md +154 -0
- package/dist/config.d.ts +104 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +248 -0
- package/dist/config.js.map +1 -0
- package/dist/connection.d.ts +49 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +126 -0
- package/dist/connection.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +15 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +57 -0
- package/dist/logger.js.map +1 -0
- package/dist/odata-client.d.ts +102 -0
- package/dist/odata-client.d.ts.map +1 -0
- package/dist/odata-client.js +226 -0
- package/dist/odata-client.js.map +1 -0
- package/dist/odata-parser.d.ts +64 -0
- package/dist/odata-parser.d.ts.map +1 -0
- package/dist/odata-parser.js +126 -0
- package/dist/odata-parser.js.map +1 -0
- package/dist/tools/configuration.d.ts +69 -0
- package/dist/tools/configuration.d.ts.map +1 -0
- package/dist/tools/configuration.js +221 -0
- package/dist/tools/configuration.js.map +1 -0
- package/dist/tools/connection.d.ts +66 -0
- package/dist/tools/connection.d.ts.map +1 -0
- package/dist/tools/connection.js +230 -0
- package/dist/tools/connection.js.map +1 -0
- package/dist/tools/index.d.ts +319 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +48 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/odata.d.ts +233 -0
- package/dist/tools/odata.d.ts.map +1 -0
- package/dist/tools/odata.js +404 -0
- package/dist/tools/odata.js.map +1 -0
- package/dist/transport.d.ts +18 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +138 -0
- package/dist/transport.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { connectionManager } from "../connection.js";
|
|
2
|
+
import { logger } from "../logger.js";
|
|
3
|
+
/**
|
|
4
|
+
* Connection Tool Definitions
|
|
5
|
+
*/
|
|
6
|
+
export const connectionTools = [
|
|
7
|
+
{
|
|
8
|
+
name: "fm_odata_connect",
|
|
9
|
+
description: "Connect to FileMaker Server with inline credentials (temporary connection, not saved)",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
server: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "FileMaker Server URL (e.g., 'http://192.168.0.24' or 'https://fms.example.com')",
|
|
16
|
+
},
|
|
17
|
+
database: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Database name (e.g., 'Contacts')",
|
|
20
|
+
},
|
|
21
|
+
user: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Username",
|
|
24
|
+
},
|
|
25
|
+
password: {
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "Password",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ["server", "database", "user", "password"],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "fm_odata_set_connection",
|
|
35
|
+
description: "Switch to a pre-configured connection by name",
|
|
36
|
+
inputSchema: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
name: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Connection name (must be previously configured)",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
required: ["name"],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "fm_odata_list_connections",
|
|
49
|
+
description: "List all configured connections (passwords masked)",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {},
|
|
53
|
+
required: [],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "fm_odata_get_current_connection",
|
|
58
|
+
description: "Get details of the current active connection",
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: "object",
|
|
61
|
+
properties: {},
|
|
62
|
+
required: [],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
/**
|
|
67
|
+
* Connection Tool Handlers
|
|
68
|
+
*/
|
|
69
|
+
export async function handleConnectionTool(name, args) {
|
|
70
|
+
try {
|
|
71
|
+
logger.debug(`Handling connection tool: ${name}`, args);
|
|
72
|
+
switch (name) {
|
|
73
|
+
case "fm_odata_connect":
|
|
74
|
+
return await handleConnect(args);
|
|
75
|
+
case "fm_odata_set_connection":
|
|
76
|
+
return await handleSetConnection(args);
|
|
77
|
+
case "fm_odata_list_connections":
|
|
78
|
+
return await handleListConnections();
|
|
79
|
+
case "fm_odata_get_current_connection":
|
|
80
|
+
return await handleGetCurrentConnection();
|
|
81
|
+
default:
|
|
82
|
+
return {
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: `Unknown connection tool: ${name}`,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
isError: true,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
logger.error(`Error in ${name}:`, error);
|
|
95
|
+
return {
|
|
96
|
+
content: [
|
|
97
|
+
{
|
|
98
|
+
type: "text",
|
|
99
|
+
text: `Error: ${error.message}`,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
isError: true,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Connection Tool Handlers
|
|
107
|
+
async function handleConnect(args) {
|
|
108
|
+
const { getConfig } = await import("../config.js");
|
|
109
|
+
const config = getConfig();
|
|
110
|
+
const connection = {
|
|
111
|
+
server: args.server,
|
|
112
|
+
database: args.database,
|
|
113
|
+
user: args.user,
|
|
114
|
+
password: args.password,
|
|
115
|
+
};
|
|
116
|
+
const client = connectionManager.createInlineClient(connection, config.filemaker.verifySsl, config.filemaker.timeout);
|
|
117
|
+
// Test the connection
|
|
118
|
+
const isConnected = await client.testConnection();
|
|
119
|
+
if (isConnected) {
|
|
120
|
+
return {
|
|
121
|
+
content: [
|
|
122
|
+
{
|
|
123
|
+
type: "text",
|
|
124
|
+
text: `Connected to ${args.server}/${args.database} as ${args.user}`,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return {
|
|
131
|
+
content: [
|
|
132
|
+
{
|
|
133
|
+
type: "text",
|
|
134
|
+
text: `Failed to connect to ${args.server}/${args.database}. Please check your credentials and server URL.`,
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
isError: true,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function handleSetConnection(args) {
|
|
142
|
+
const { getConfig } = await import("../config.js");
|
|
143
|
+
const config = getConfig();
|
|
144
|
+
// Pass verifySsl and timeout from global config
|
|
145
|
+
connectionManager.setCurrentConnection(args.name, config.filemaker.verifySsl, config.filemaker.timeout);
|
|
146
|
+
// Test the connection
|
|
147
|
+
const isConnected = await connectionManager.testConnection(args.name);
|
|
148
|
+
if (isConnected) {
|
|
149
|
+
return {
|
|
150
|
+
content: [
|
|
151
|
+
{
|
|
152
|
+
type: "text",
|
|
153
|
+
text: `Switched to connection: ${args.name}`,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return {
|
|
160
|
+
content: [
|
|
161
|
+
{
|
|
162
|
+
type: "text",
|
|
163
|
+
text: `Switched to connection: ${args.name} (warning: connection test failed)`,
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
isError: false,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function handleListConnections() {
|
|
171
|
+
const { listConnections } = await import("../config.js");
|
|
172
|
+
const connections = listConnections();
|
|
173
|
+
if (connections.length === 0) {
|
|
174
|
+
return {
|
|
175
|
+
content: [
|
|
176
|
+
{
|
|
177
|
+
type: "text",
|
|
178
|
+
text: "No configured connections found. Use fm_odata_config_add_connection to add a connection or fm_odata_connect for a temporary connection.",
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const list = connections
|
|
184
|
+
.map((conn) => {
|
|
185
|
+
return `- ${conn.name}: ${conn.server}/${conn.database} (user: ${conn.user})`;
|
|
186
|
+
})
|
|
187
|
+
.join("\n");
|
|
188
|
+
return {
|
|
189
|
+
content: [
|
|
190
|
+
{
|
|
191
|
+
type: "text",
|
|
192
|
+
text: `Configured connections:\n${list}`,
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
async function handleGetCurrentConnection() {
|
|
198
|
+
const connectionName = connectionManager.getCurrentConnectionName();
|
|
199
|
+
if (!connectionName) {
|
|
200
|
+
return {
|
|
201
|
+
content: [
|
|
202
|
+
{
|
|
203
|
+
type: "text",
|
|
204
|
+
text: "No active connection. Use fm_odata_connect or fm_odata_set_connection to establish a connection.",
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
const { getConnection } = await import("../config.js");
|
|
210
|
+
const connection = getConnection(connectionName);
|
|
211
|
+
if (!connection) {
|
|
212
|
+
return {
|
|
213
|
+
content: [
|
|
214
|
+
{
|
|
215
|
+
type: "text",
|
|
216
|
+
text: `Active connection: ${connectionName} (inline/temporary)`,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
content: [
|
|
223
|
+
{
|
|
224
|
+
type: "text",
|
|
225
|
+
text: `Current connection: ${connection.name}\nServer: ${connection.server}\nDatabase: ${connection.database}\nUser: ${connection.user}`,
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/tools/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,uFAAuF;QACpG,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iFAAiF;iBAC/F;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kCAAkC;iBAChD;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,UAAU;iBACxB;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,UAAU;iBACxB;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC;SACrD;KACF;IACD;QACE,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EAAE,+CAA+C;QAC5D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iDAAiD;iBAC/D;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,oDAAoD;QACjE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;SACb;KACF;IACD;Q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,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,kGAAkG;iBACzG;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;IAEjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,sBAAsB,cAAc,qBAAqB;iBAChE;aACF;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,uBAAuB,UAAU,CAAC,IAAI,aAAa,UAAU,CAAC,MAAM,eAAe,UAAU,CAAC,QAAQ,WAAW,UAAU,CAAC,IAAI,EAAE;aACzI;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All tool definitions
|
|
3
|
+
*/
|
|
4
|
+
export declare const allTools: ({
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
table?: undefined;
|
|
11
|
+
filter?: undefined;
|
|
12
|
+
select?: undefined;
|
|
13
|
+
orderby?: undefined;
|
|
14
|
+
top?: undefined;
|
|
15
|
+
skip?: undefined;
|
|
16
|
+
expand?: undefined;
|
|
17
|
+
count?: undefined;
|
|
18
|
+
recordId?: undefined;
|
|
19
|
+
data?: undefined;
|
|
20
|
+
};
|
|
21
|
+
required: never[];
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: string;
|
|
28
|
+
properties: {
|
|
29
|
+
table: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
filter: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
select: {
|
|
38
|
+
type: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
orderby: {
|
|
42
|
+
type: string;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
top: {
|
|
46
|
+
type: string;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
skip: {
|
|
50
|
+
type: string;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
expand: {
|
|
54
|
+
type: string;
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
count: {
|
|
58
|
+
type: string;
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
recordId?: undefined;
|
|
62
|
+
data?: undefined;
|
|
63
|
+
};
|
|
64
|
+
required: string[];
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: string;
|
|
71
|
+
properties: {
|
|
72
|
+
table: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
recordId: {
|
|
77
|
+
type: string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
select: {
|
|
81
|
+
type: string;
|
|
82
|
+
description: string;
|
|
83
|
+
};
|
|
84
|
+
expand: {
|
|
85
|
+
type: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
filter?: undefined;
|
|
89
|
+
orderby?: undefined;
|
|
90
|
+
top?: undefined;
|
|
91
|
+
skip?: undefined;
|
|
92
|
+
count?: undefined;
|
|
93
|
+
data?: undefined;
|
|
94
|
+
};
|
|
95
|
+
required: string[];
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
name: string;
|
|
99
|
+
description: string;
|
|
100
|
+
inputSchema: {
|
|
101
|
+
type: string;
|
|
102
|
+
properties: {
|
|
103
|
+
table: {
|
|
104
|
+
type: string;
|
|
105
|
+
description: string;
|
|
106
|
+
};
|
|
107
|
+
top: {
|
|
108
|
+
type: string;
|
|
109
|
+
description: string;
|
|
110
|
+
};
|
|
111
|
+
skip: {
|
|
112
|
+
type: string;
|
|
113
|
+
description: string;
|
|
114
|
+
};
|
|
115
|
+
filter?: undefined;
|
|
116
|
+
select?: undefined;
|
|
117
|
+
orderby?: undefined;
|
|
118
|
+
expand?: undefined;
|
|
119
|
+
count?: undefined;
|
|
120
|
+
recordId?: undefined;
|
|
121
|
+
data?: undefined;
|
|
122
|
+
};
|
|
123
|
+
required: string[];
|
|
124
|
+
};
|
|
125
|
+
} | {
|
|
126
|
+
name: string;
|
|
127
|
+
description: string;
|
|
128
|
+
inputSchema: {
|
|
129
|
+
type: string;
|
|
130
|
+
properties: {
|
|
131
|
+
table: {
|
|
132
|
+
type: string;
|
|
133
|
+
description: string;
|
|
134
|
+
};
|
|
135
|
+
filter: {
|
|
136
|
+
type: string;
|
|
137
|
+
description: string;
|
|
138
|
+
};
|
|
139
|
+
select?: undefined;
|
|
140
|
+
orderby?: undefined;
|
|
141
|
+
top?: undefined;
|
|
142
|
+
skip?: undefined;
|
|
143
|
+
expand?: undefined;
|
|
144
|
+
count?: undefined;
|
|
145
|
+
recordId?: undefined;
|
|
146
|
+
data?: undefined;
|
|
147
|
+
};
|
|
148
|
+
required: string[];
|
|
149
|
+
};
|
|
150
|
+
} | {
|
|
151
|
+
name: string;
|
|
152
|
+
description: string;
|
|
153
|
+
inputSchema: {
|
|
154
|
+
type: string;
|
|
155
|
+
properties: {
|
|
156
|
+
table: {
|
|
157
|
+
type: string;
|
|
158
|
+
description: string;
|
|
159
|
+
};
|
|
160
|
+
data: {
|
|
161
|
+
type: string;
|
|
162
|
+
description: string;
|
|
163
|
+
};
|
|
164
|
+
filter?: undefined;
|
|
165
|
+
select?: undefined;
|
|
166
|
+
orderby?: undefined;
|
|
167
|
+
top?: undefined;
|
|
168
|
+
skip?: undefined;
|
|
169
|
+
expand?: undefined;
|
|
170
|
+
count?: undefined;
|
|
171
|
+
recordId?: undefined;
|
|
172
|
+
};
|
|
173
|
+
required: string[];
|
|
174
|
+
};
|
|
175
|
+
} | {
|
|
176
|
+
name: string;
|
|
177
|
+
description: string;
|
|
178
|
+
inputSchema: {
|
|
179
|
+
type: string;
|
|
180
|
+
properties: {
|
|
181
|
+
table: {
|
|
182
|
+
type: string;
|
|
183
|
+
description: string;
|
|
184
|
+
};
|
|
185
|
+
recordId: {
|
|
186
|
+
type: string;
|
|
187
|
+
description: string;
|
|
188
|
+
};
|
|
189
|
+
data: {
|
|
190
|
+
type: string;
|
|
191
|
+
description: string;
|
|
192
|
+
};
|
|
193
|
+
filter?: undefined;
|
|
194
|
+
select?: undefined;
|
|
195
|
+
orderby?: undefined;
|
|
196
|
+
top?: undefined;
|
|
197
|
+
skip?: undefined;
|
|
198
|
+
expand?: undefined;
|
|
199
|
+
count?: undefined;
|
|
200
|
+
};
|
|
201
|
+
required: string[];
|
|
202
|
+
};
|
|
203
|
+
} | {
|
|
204
|
+
name: string;
|
|
205
|
+
description: string;
|
|
206
|
+
inputSchema: {
|
|
207
|
+
type: string;
|
|
208
|
+
properties: {
|
|
209
|
+
table: {
|
|
210
|
+
type: string;
|
|
211
|
+
description: string;
|
|
212
|
+
};
|
|
213
|
+
recordId: {
|
|
214
|
+
type: string;
|
|
215
|
+
description: string;
|
|
216
|
+
};
|
|
217
|
+
filter?: undefined;
|
|
218
|
+
select?: undefined;
|
|
219
|
+
orderby?: undefined;
|
|
220
|
+
top?: undefined;
|
|
221
|
+
skip?: undefined;
|
|
222
|
+
expand?: undefined;
|
|
223
|
+
count?: undefined;
|
|
224
|
+
data?: undefined;
|
|
225
|
+
};
|
|
226
|
+
required: string[];
|
|
227
|
+
};
|
|
228
|
+
} | {
|
|
229
|
+
name: string;
|
|
230
|
+
description: string;
|
|
231
|
+
inputSchema: {
|
|
232
|
+
type: string;
|
|
233
|
+
properties: {
|
|
234
|
+
server: {
|
|
235
|
+
type: string;
|
|
236
|
+
description: string;
|
|
237
|
+
};
|
|
238
|
+
database: {
|
|
239
|
+
type: string;
|
|
240
|
+
description: string;
|
|
241
|
+
};
|
|
242
|
+
user: {
|
|
243
|
+
type: string;
|
|
244
|
+
description: string;
|
|
245
|
+
};
|
|
246
|
+
password: {
|
|
247
|
+
type: string;
|
|
248
|
+
description: string;
|
|
249
|
+
};
|
|
250
|
+
name?: undefined;
|
|
251
|
+
};
|
|
252
|
+
required: string[];
|
|
253
|
+
};
|
|
254
|
+
} | {
|
|
255
|
+
name: string;
|
|
256
|
+
description: string;
|
|
257
|
+
inputSchema: {
|
|
258
|
+
type: string;
|
|
259
|
+
properties: {
|
|
260
|
+
name: {
|
|
261
|
+
type: string;
|
|
262
|
+
description: string;
|
|
263
|
+
};
|
|
264
|
+
server?: undefined;
|
|
265
|
+
database?: undefined;
|
|
266
|
+
user?: undefined;
|
|
267
|
+
password?: undefined;
|
|
268
|
+
};
|
|
269
|
+
required: string[];
|
|
270
|
+
};
|
|
271
|
+
} | {
|
|
272
|
+
name: string;
|
|
273
|
+
description: string;
|
|
274
|
+
inputSchema: {
|
|
275
|
+
type: string;
|
|
276
|
+
properties: {
|
|
277
|
+
server?: undefined;
|
|
278
|
+
database?: undefined;
|
|
279
|
+
user?: undefined;
|
|
280
|
+
password?: undefined;
|
|
281
|
+
name?: undefined;
|
|
282
|
+
};
|
|
283
|
+
required: never[];
|
|
284
|
+
};
|
|
285
|
+
} | {
|
|
286
|
+
name: string;
|
|
287
|
+
description: string;
|
|
288
|
+
inputSchema: {
|
|
289
|
+
type: string;
|
|
290
|
+
properties: {
|
|
291
|
+
name: {
|
|
292
|
+
type: string;
|
|
293
|
+
description: string;
|
|
294
|
+
};
|
|
295
|
+
server: {
|
|
296
|
+
type: string;
|
|
297
|
+
description: string;
|
|
298
|
+
};
|
|
299
|
+
database: {
|
|
300
|
+
type: string;
|
|
301
|
+
description: string;
|
|
302
|
+
};
|
|
303
|
+
user: {
|
|
304
|
+
type: string;
|
|
305
|
+
description: string;
|
|
306
|
+
};
|
|
307
|
+
password: {
|
|
308
|
+
type: string;
|
|
309
|
+
description: string;
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
required: string[];
|
|
313
|
+
};
|
|
314
|
+
})[];
|
|
315
|
+
/**
|
|
316
|
+
* Route tool calls to appropriate handler
|
|
317
|
+
*/
|
|
318
|
+
export declare function handleToolCall(name: string, args: any): Promise<any>;
|
|
319
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIpB,CAAC;AAEF;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAmC1E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { odataTools, handleODataTool } from "./odata.js";
|
|
2
|
+
import { connectionTools, handleConnectionTool } from "./connection.js";
|
|
3
|
+
import { configurationTools, handleConfigurationTool } from "./configuration.js";
|
|
4
|
+
/**
|
|
5
|
+
* All tool definitions
|
|
6
|
+
*/
|
|
7
|
+
export const allTools = [
|
|
8
|
+
...odataTools,
|
|
9
|
+
...connectionTools,
|
|
10
|
+
...configurationTools,
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Route tool calls to appropriate handler
|
|
14
|
+
*/
|
|
15
|
+
export async function handleToolCall(name, args) {
|
|
16
|
+
// OData tools
|
|
17
|
+
if (name.startsWith("fm_odata_get_") ||
|
|
18
|
+
name.startsWith("fm_odata_query_") ||
|
|
19
|
+
name.startsWith("fm_odata_list_") ||
|
|
20
|
+
name.startsWith("fm_odata_count_") ||
|
|
21
|
+
name.startsWith("fm_odata_create_") ||
|
|
22
|
+
name.startsWith("fm_odata_update_") ||
|
|
23
|
+
name.startsWith("fm_odata_delete_")) {
|
|
24
|
+
return await handleODataTool(name, args);
|
|
25
|
+
}
|
|
26
|
+
// Connection tools
|
|
27
|
+
if (name === "fm_odata_connect" ||
|
|
28
|
+
name === "fm_odata_set_connection" ||
|
|
29
|
+
name === "fm_odata_list_connections" ||
|
|
30
|
+
name === "fm_odata_get_current_connection") {
|
|
31
|
+
return await handleConnectionTool(name, args);
|
|
32
|
+
}
|
|
33
|
+
// Configuration tools
|
|
34
|
+
if (name.startsWith("fm_odata_config_")) {
|
|
35
|
+
return await handleConfigurationTool(name, args);
|
|
36
|
+
}
|
|
37
|
+
// Unknown tool
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: `Unknown tool: ${name}`,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
isError: true,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACzD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