feat: full Komodo API coverage — 11 tools, ~336 endpoints
Expand from 7 tools to 11 tools covering 100% of the Komodo v2.3.2 API: New tools: - komodo_summary: resource summaries/stats - komodo_inspect: Docker object inspection (16 types) - komodo_search_logs: log search with query - komodo_list_detail: extended listing (27 types) Expanded existing tools: - 12 → 21 resource types (action, repo, builder, swarm, variable, user_group, alert, terminal, git_provider_account) - 37 → 100+ execute operations - komodo_logs: 4 resource types with proper endpoints Other changes: - API key auth support (X-Api-Key / X-Api-Secret headers) - 30s fetch timeout + structured error handling - Updated docs: references/api.md (483 lines), README.md (238 lines)
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { z } from "zod";
|
||||
import { KomodoClient } from "../komodo-client.js";
|
||||
import { LIST_DETAIL_REQUEST_MAP } from "../types.js";
|
||||
|
||||
const listDetailType = z.enum([
|
||||
"containers", "all_containers", "images", "networks", "volumes",
|
||||
"system_processes", "schedules", "permissions", "api_keys",
|
||||
"api_keys_for_service_user", "onboarding_keys", "secrets", "updates",
|
||||
"build_versions", "compose_projects", "user_target_permissions",
|
||||
"full_stacks", "full_builds", "full_servers", "full_deployments",
|
||||
"full_procedures", "full_repos", "full_builders", "full_swarms",
|
||||
"full_actions", "full_alerters", "full_resource_syncs",
|
||||
]);
|
||||
|
||||
export const listDetailInputSchema = {
|
||||
list_type: listDetailType.describe(
|
||||
"What to list (containers, images, networks, volumes, full_stacks, full_builds, etc.)"
|
||||
),
|
||||
server: z.string().optional().describe("Server name (required for container/image/network/volume listings)"),
|
||||
pattern: z.string().optional().describe("Filter pattern (for batch operations)"),
|
||||
};
|
||||
|
||||
export async function handleListDetail(
|
||||
args: {
|
||||
list_type: z.infer<typeof listDetailType>;
|
||||
server?: string;
|
||||
pattern?: string;
|
||||
},
|
||||
client: KomodoClient,
|
||||
): Promise<{ content: { type: "text"; text: string }[] }> {
|
||||
const { list_type, server, pattern } = args;
|
||||
|
||||
const requestName = LIST_DETAIL_REQUEST_MAP[list_type];
|
||||
if (!requestName) {
|
||||
throw new Error(`Unknown list detail type: ${list_type}`);
|
||||
}
|
||||
|
||||
const params: Record<string, unknown> = {};
|
||||
if (server) params.server = server;
|
||||
if (pattern) params.pattern = pattern;
|
||||
|
||||
const result = await client.rpc("read", requestName, params);
|
||||
|
||||
const items = Array.isArray(result) ? result : [result];
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: JSON.stringify(items, null, 2),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user