list_functions
Retrieve deployed functions for a project with details including names, URLs, runtime, timeout, and memory settings.
Instructions
List all deployed functions for a project. Shows names, URLs, runtime, timeout, and memory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The project ID |
Implementation Reference
- src/tools/list-functions.ts:10-62 (handler)The handler function that executes the list_functions tool logic. It fetches all deployed functions for a project from the API, validates the project exists, and returns formatted output as a markdown table or a message if no functions exist.
export async function handleListFunctions(args: { project_id: string; }): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: boolean }> { const project = getProject(args.project_id); if (!project) return projectNotFound(args.project_id); const res = await apiRequest(`/admin/v1/projects/${args.project_id}/functions`, { method: "GET", headers: { Authorization: `Bearer ${project.service_key}`, }, }); if (!res.ok) return formatApiError(res, "listing functions"); const body = res.body as { functions: Array<{ name: string; url: string; runtime: string; timeout: number; memory: number; created_at: string; updated_at: string; }>; }; if (body.functions.length === 0) { return { content: [ { type: "text", text: `## Functions\n\n_No functions deployed. Use \`deploy_function\` to deploy one._`, }, ], }; } const lines = [ `## Functions (${body.functions.length})`, ``, `| Name | URL | Runtime | Timeout | Memory |`, `|------|-----|---------|---------|--------|`, ]; for (const fn of body.functions) { lines.push( `| ${fn.name} | ${fn.url} | ${fn.runtime} | ${fn.timeout}s | ${fn.memory}MB |`, ); } return { content: [{ type: "text", text: lines.join("\n") }] }; } - src/tools/list-functions.ts:6-8 (schema)Input schema definition for the list_functions tool, requiring a project_id parameter as a string.
export const listFunctionsSchema = { project_id: z.string().describe("The project ID"), }; - src/index.ts:160-165 (registration)Registration of the list_functions tool with the MCP server, including the tool name, description, schema, and handler.
server.tool( "list_functions", "List all deployed functions for a project. Shows names, URLs, runtime, timeout, and memory.", listFunctionsSchema, async (args) => handleListFunctions(args), );