MCPcopy Create free account
hub / github.com/ReAPI-com/mcp-openapi / setUpTools

Method setUpTools

src/McpService.ts:47–248  ·  view source on GitHub ↗
(server: McpServer)

Source from the content-addressed store, hash-verified

45 }
46
47 private setUpTools(server: McpServer) {
48 server.tool("refresh-api-catalog", "Refresh the API catalog", async () => {
49 try {
50 this.logger.info('Refreshing API catalog');
51 await this.specExplorer.refresh();
52 this.logger.info('API catalog refreshed successfully');
53 return {
54 content: [{ type: "text", text: "API catalog refreshed" }],
55 };
56 } catch (error) {
57 this.logger.error('Failed to refresh API catalog', { error });
58 throw error;
59 }
60 });
61
62 // server.tool(
63 // 'sync-api-catalog',
64 // 'Sync the API catalog',
65 // async () => {
66 // await this.specExplorer.sync();
67 // return {
68 // content: [{ type: "text", text: "API catalog synced" }],
69 // };
70 // }
71 // );
72
73 server.tool(
74 "get-api-catalog",
75 "Get the API catalog, the catalog contains metadata about all openapi specifications, their operations and schemas",
76 async () => {
77 try {
78 this.logger.debug('Getting API catalog');
79 const catalog = await this.specExplorer.getApiCatalog();
80 return {
81 content: [
82 { type: "text", text: stringify({ catalog }, { indent: 2 }) },
83 ],
84 };
85 } catch (error) {
86 this.logger.error('Failed to get API catalog', { error });
87 throw error;
88 }
89 }
90 );
91
92 server.tool(
93 "search-api-operations",
94 "Search for operations across specifications",
95 {
96 query: z.string(),
97 specId: z.string().optional(),
98 },
99 async (args, extra) => {
100 try {
101 this.logger.debug('Searching API operations', { query: args.query, specId: args.specId });
102 const operations = await this.specExplorer.searchOperations(
103 args.query,
104 args.specId

Callers 1

createServerMethod · 0.95

Calls 11

infoMethod · 0.65
refreshMethod · 0.65
errorMethod · 0.65
debugMethod · 0.65
getApiCatalogMethod · 0.65
searchOperationsMethod · 0.65
searchSchemasMethod · 0.65
findOperationByIdMethod · 0.65
warnMethod · 0.65
findSchemaByNameMethod · 0.65

Tested by

no test coverage detected