Skip to main content
Glama

delete_function

Remove a deployed function from a project by specifying the project ID and function name. This tool helps manage serverless infrastructure by deleting functions no longer needed.

Instructions

Delete a deployed function from a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe project ID
nameYesFunction name to delete

Implementation Reference

  • The handleDeleteFunction async function implements the delete_function tool. It validates the project exists via getProject(), makes a DELETE API request to /admin/v1/projects/{project_id}/functions/{name}, and returns a success message or error.
    export async function handleDeleteFunction(args: {
      project_id: string;
      name: 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/${encodeURIComponent(args.name)}`,
        {
          method: "DELETE",
          headers: {
            Authorization: `Bearer ${project.service_key}`,
          },
        },
      );
    
      if (!res.ok) return formatApiError(res, "deleting function");
    
      return {
        content: [
          {
            type: "text",
            text: `Function \`${args.name}\` deleted from project \`${args.project_id}\`.`,
          },
        ],
      };
    }
  • The deleteFunctionSchema defines the input validation using Zod: project_id (string) and name (string) for the function to delete.
    export const deleteFunctionSchema = {
      project_id: z.string().describe("The project ID"),
      name: z.string().describe("Function name to delete"),
    };
  • src/index.ts:167-172 (registration)
    Registration of the delete_function tool with the MCP server, providing the tool name, description, schema, and handler function.
    server.tool(
      "delete_function",
      "Delete a deployed function from a project.",
      deleteFunctionSchema,
      async (args) => handleDeleteFunction(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