delete_esa_post
Remove posts from esa.io documentation by specifying the post number to delete content from your team's knowledge base.
Instructions
Delete a post in esa.io. Required parameters: postNumber.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| teamName | No | my-team | |
| postNumber | Yes |
Implementation Reference
- src/server.ts:204-214 (registration)Registers the 'delete_esa_post' MCP tool with description, input schema using Zod, and an async handler function that delegates to ApiClient.deletePost.server.tool( "delete_esa_post", "Delete a post in esa.io. Required parameters: postNumber.", { teamName: z.string().default(getRequiredEnv("DEFAULT_ESA_TEAM")), postNumber: z.number(), }, async (input) => await formatTool(async () => client.deletePost(input.teamName, input.postNumber) )
- src/api.ts:146-154 (handler)ApiClient.deletePost: Performs the HTTP DELETE request to esa.io API endpoint for deleting a specific post, using generated esaAPI function and callApi wrapper.async deletePost(teamName: string, postNumber: number) { return this.callApi(() => deleteV1TeamsTeamNamePostsPostNumber(teamName, postNumber, { headers: { Authorization: `Bearer ${this.apiKey}`, }, }) ).then((response) => response.data) }
- src/server.ts:207-209 (schema)Zod input schema for delete_esa_post tool: teamName (string, optional default from env), postNumber (required number).{ teamName: z.string().default(getRequiredEnv("DEFAULT_ESA_TEAM")), postNumber: z.number(),
- src/formatTool.ts:34-61 (helper)formatTool helper: Executes tool callback, converts result to YAML-formatted text content for MCP response, handles success and errors uniformly.export const formatTool = async ( cb: () => unknown ): Promise<CallToolResult> => { try { const result = await cb() return { content: [ { type: "text", text: stringify(toResponse(result)), }, ], } } catch (error) { console.error("Error in formatTool:", error) return { isError: true, content: [ { type: "text", text: `Error: ${error instanceof Error ? `${error.name}: ${error.message}` : String(error)}`, }, ], } } }
- src/api.ts:32-54 (helper)callApi private method in ApiClient: Handles API responses, checks status codes (200,201,204 success), throws ApiError on failures with appropriate messages.private async callApi<T extends { status: number; data: unknown }>( cb: () => Promise<T> ) { const response = await cb() if ( response.status === 200 || response.status === 201 || response.status === 204 ) { return response as T extends { status: 200 | 201 | 204 } ? T : never } else { if ( typeof response.data === "object" && response.data !== null && "message" in response.data && typeof response.data.message === "string" ) { throw new ApiError(response.data.message) } throw new ApiError(`Api Error: ${response.status}`) } }