fix: verified map names, param remaps, and write lifecycle test
- Fix tag create: AddTag → CreateTag
- Fix tag update: UpdateTag → UpdateTagColor, param {id} → {tag}
- Fix sync_resource create/update: CreateSyncResource → CreateResourceSync,
UpdateSyncResource → UpdateResourceSync
- Add GET/DELETE param remapping for tag ({tag}), variable ({name}),
user_group ({user_group}) — same pattern as INSPECT_PARAM_KEY
- Update api.md with corrected endpoint names
- Add scripts/test_write_lifecycle.py — full CRUD lifecycle test
covering 15 resource types across 4 tiers, urllib-only
All fixes verified live against Core v2.3.3 error responses.
This commit is contained in:
+10
-1
@@ -2,6 +2,14 @@ import { z } from "zod";
|
||||
import { KomodoClient } from "../komodo-client.js";
|
||||
import { ResourceType, DELETE_REQUEST_MAP } from "../types.js";
|
||||
|
||||
// Some DELETE endpoints expect a different param key instead of { id }.
|
||||
// Verified live against Core v2.3.3 error messages.
|
||||
const DELETE_PARAM_KEY: Record<string, string> = {
|
||||
tag: "tag",
|
||||
variable: "name",
|
||||
user_group: "user_group",
|
||||
};
|
||||
|
||||
export const deleteInputSchema = {
|
||||
resource_type: ResourceType.describe(
|
||||
"Resource type to delete (stack, build, server, procedure, deployment, alerter, sync_resource, tag)",
|
||||
@@ -22,7 +30,8 @@ export async function handleDelete(
|
||||
);
|
||||
}
|
||||
|
||||
const result = await client.rpc("write", requestName, { id });
|
||||
const paramKey = DELETE_PARAM_KEY[resource_type] || "id";
|
||||
const result = await client.rpc("write", requestName, { [paramKey]: id });
|
||||
|
||||
return {
|
||||
content: [
|
||||
|
||||
+10
-1
@@ -2,6 +2,14 @@ import { z } from "zod";
|
||||
import { KomodoClient } from "../komodo-client.js";
|
||||
import { ResourceType, GET_REQUEST_MAP } from "../types.js";
|
||||
|
||||
// Some GET endpoints expect a different param key instead of { id }.
|
||||
// Verified live against Core v2.3.3 error messages.
|
||||
const GET_PARAM_KEY: Record<string, string> = {
|
||||
tag: "tag",
|
||||
variable: "name",
|
||||
user_group: "user_group",
|
||||
};
|
||||
|
||||
export const getInputSchema = {
|
||||
resource_type: ResourceType.describe(
|
||||
"Resource type to get (stack, build, server, procedure, deployment, alerter, image_registry_account, sync_resource, user, tag, execution, access_request)",
|
||||
@@ -22,7 +30,8 @@ export async function handleGet(
|
||||
);
|
||||
}
|
||||
|
||||
const result = await client.rpc("read", requestName, { id });
|
||||
const paramKey = GET_PARAM_KEY[resource_type] || "id";
|
||||
const result = await client.rpc("read", requestName, { [paramKey]: id });
|
||||
|
||||
return {
|
||||
content: [
|
||||
|
||||
+4
-1
@@ -32,7 +32,10 @@ export async function handleUpdate(
|
||||
);
|
||||
}
|
||||
|
||||
const result = await client.rpc("write", requestName, { id, ...params });
|
||||
// Tag update uses {tag} instead of {id} (same INSPECT_PARAM_KEY pattern)
|
||||
const body =
|
||||
resource_type === "tag" ? { tag: id, ...params } : { id, ...params };
|
||||
const result = await client.rpc("write", requestName, body);
|
||||
|
||||
return {
|
||||
content: [
|
||||
|
||||
Reference in New Issue
Block a user