@mondaydotcomorg/atp-client
Version:
Client SDK for Agent Tool Protocol
47 lines • 1.88 kB
JavaScript
import { z } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';
import { ToolNames } from './types.js';
const exploreApiInputSchema = z.object({
path: z
.string()
.describe('Path to explore (e.g., "/", "/openapi/github", "/mcp/filesystem/read_file")'),
});
export function createExploreApiTool(client) {
return {
name: ToolNames.EXPLORE_API,
description: 'Explore APIs using filesystem-like navigation. Navigate through directories to discover available functions. Provide path as string like "/", "/openapi", "/openapi/github", or "/openapi/github/repos/createRepo" to see functions.',
inputSchema: zodToJsonSchema(exploreApiInputSchema),
zodSchema: exploreApiInputSchema,
func: async (input) => {
try {
const result = await client.exploreAPI(input.path);
if (result.type === 'directory') {
return JSON.stringify({
success: true,
type: 'directory',
path: result.path,
items: result.items,
}, null, 2);
}
else {
return JSON.stringify({
success: true,
type: 'function',
name: result.name,
description: result.description,
definition: result.definition,
group: result.group,
path: result.path,
}, null, 2);
}
}
catch (error) {
return JSON.stringify({
success: false,
error: error.message,
}, null, 2);
}
},
};
}
//# sourceMappingURL=explore-api.js.map