cf_list_services
List Cloud Foundry service instances in a specified space by providing the space GUID.
Instructions
List Cloud Foundry service instances
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_guid | No |
Implementation Reference
- src/tools/cloud-foundry/index.ts:31-33 (registration)Registration of the cf_list_services tool via server.tool(), defining its name, description, input schema (optional space_guid), and handler.
server.tool("cf_list_services", "List Cloud Foundry service instances", { space_guid: z.string().optional(), }, async (p) => safeTool(() => client.get(`${base}/v3/service_instances`, {space_guids:p.space_guid}))); - src/tools/cloud-foundry/index.ts:33-33 (handler)The tool handler: makes an authenticated GET request to the Cloud Foundry API's /v3/service_instances endpoint, passing optional space_guids query parameter.
}, async (p) => safeTool(() => client.get(`${base}/v3/service_instances`, {space_guids:p.space_guid}))); - Input schema defined using Zod: optional space_guid string parameter to filter service instances by space.
space_guid: z.string().optional(), - src/lib/utils.ts:70-77 (helper)safeTool helper wraps the handler to catch errors and return formatted MCP text content 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); } } - src/lib/api-client.ts:128-130 (helper)The client.get() method used by the handler to perform the authenticated HTTP GET request to the Cloud Foundry API.
async get<T = unknown>(url: string, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> { return this.request<T>(url, { method: "GET", queryParams }); }