schematics_list_actions
List all available Schematics actions to manage infrastructure as code on IBM Cloud.
Instructions
List Schematics actions
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- src/tools/schematics/index.ts:51-53 (handler)The handler for the schematics_list_actions tool. It makes a GET request to the Schematics V2 API /actions endpoint with an optional limit parameter, defaulting to 100.
server.tool("schematics_list_actions", "List Schematics actions", { limit: z.number().optional(), }, async (p) => safeTool(() => client.get(`${baseV2}/actions`, {limit:p.limit||100}))); - src/tools/schematics/index.ts:51-53 (schema)Input schema for schematics_list_actions: accepts an optional 'limit' number parameter.
server.tool("schematics_list_actions", "List Schematics actions", { limit: z.number().optional(), }, async (p) => safeTool(() => client.get(`${baseV2}/actions`, {limit:p.limit||100}))); - src/tools/schematics/index.ts:7-58 (registration)Registration function registerSchematicsTools is exported and called from src/server.ts. The tool is registered via server.tool() within this function.
export function registerSchematicsTools(server: McpServer, client: IBMCloudAPIClient, config: ServerConfig) { const base = IBM_ENDPOINTS.SCHEMATICS(config.region); const baseV2 = IBM_ENDPOINTS.SCHEMATICS_V2(config.region); const w = () => assertWriteAllowed(config.allowWrite); server.tool("schematics_list_workspaces", "List Schematics workspaces", { limit: z.number().optional(), }, async (p) => safeTool(() => client.get(`${base}/workspaces`, {limit:p.limit||100}))); server.tool("schematics_get_workspace", "Get workspace details", { workspace_id: z.string(), }, async (p) => safeTool(() => client.get(`${base}/workspaces/${p.workspace_id}`))); server.tool("schematics_create_workspace", "Create a Schematics workspace", { name: z.string(), description: z.string().optional(), template_repo_url: z.string().describe("Git repo URL with Terraform configs"), resource_group: z.string().optional(), terraform_version: z.string().optional(), }, async (p) => safeTool(async () => { w(); return client.post(`${base}/workspaces`, { name:p.name, description:p.description, resource_group:p.resource_group, template_repo:{url:p.template_repo_url}, type:[p.terraform_version||"terraform_v1.5"], }); })); server.tool("schematics_delete_workspace", "Delete a Schematics workspace", { workspace_id: z.string(), destroy_resources: z.boolean().optional(), }, async (p) => safeTool(async () => { w(); await client.delete(`${base}/workspaces/${p.workspace_id}`, {destroy_resources:p.destroy_resources?"true":undefined}); return {message:"Workspace deleted"}; })); server.tool("schematics_plan_workspace", "Generate a Terraform plan for a workspace", { workspace_id: z.string(), }, async (p) => safeTool(async () => { w(); return client.post(`${base}/workspaces/${p.workspace_id}/plan`, {}); })); server.tool("schematics_apply_workspace", "Apply Terraform plan for a workspace", { workspace_id: z.string(), }, async (p) => safeTool(async () => { w(); return client.put(`${base}/workspaces/${p.workspace_id}/apply`, {}); })); server.tool("schematics_list_actions", "List Schematics actions", { limit: z.number().optional(), }, async (p) => safeTool(() => client.get(`${baseV2}/actions`, {limit:p.limit||100}))); server.tool("schematics_get_job", "Get Schematics job details", { job_id: z.string(), }, async (p) => safeTool(() => client.get(`${baseV2}/jobs/${p.job_id}`))); } - src/server.ts:83-84 (registration)The schematics_list_actions tool is registered as part of the Schematics tool group when createServer() is called.
registerSchematicsTools(server, client, config); console.error(` ✓ Schematics (8 tools)`); - src/lib/utils.ts:70-77 (helper)The safeTool helper wraps the handler to catch errors and return proper MCP success/error responses.
export async function safeTool<T>(fn: () => Promise<T>): Promise<ReturnType<typeof successContent> | ReturnType<typeof errorContent>> { try { const result = await fn(); return successContent(result); } catch (error) { return errorContent(error); } }