list-projects
Retrieve all Google Cloud Platform projects available with your current authentication credentials to manage and access GCP resources.
Instructions
List all GCP projects accessible with current credentials
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.ts:98-106 (registration)Registers the 'list-projects' tool with its description and empty input schema in the listTools response.
{ name: "list-projects", description: "List all GCP projects accessible with current credentials", inputSchema: { type: "object", properties: {}, required: [], }, }, - index.ts:404-406 (handler)Executes the 'list-projects' tool by calling listAvailableProjects() and formatting the response.
} else if (name === "list-projects") { const projects = await listAvailableProjects(); return createTextResponse(JSON.stringify({ projects })); - index.ts:680-690 (helper)Core logic to list accessible GCP projects using ProjectsClient.searchProjects(), with error handling.
async function listAvailableProjects(): Promise<string[]> { const projectsClient = new ProjectsClient(); try { const [projects] = await projectsClient.searchProjects(); return projects.map((p: any) => JSON.stringify(p)); } catch (error) { console.error('Error listing projects:', error); return []; } }