Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_idYesThe project ID

Implementation Reference

  • 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") }] };
    }
  • 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),
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kychee-com/run402'

If you have feedback or need assistance with the MCP directory API, please join our Discord server