Skip to main content
Glama
d-kimuson

ESA MCP Server

by d-kimuson

read_esa_post

Retrieve specific posts from esa.io using team name and post number parameters for content access and management.

Instructions

Read a post in esa.io.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
teamNameNomy-team
postNumberYes

Implementation Reference

  • src/server.ts:101-120 (registration)
    Registration of the MCP tool 'read_esa_post' with description, input schema, and handler function using server.tool.
    server.tool(
      "read_esa_post",
      "Read a post in esa.io.",
      {
        teamName: z.string().default(getRequiredEnv("DEFAULT_ESA_TEAM")),
        postNumber: z.number(),
      },
      async (input) =>
        await formatTool(async () => {
          const [response] = await client.readPosts(input.teamName, [
            input.postNumber,
          ])
    
          if (response === undefined) {
            throw new Error("post not found")
          }
    
          return response
        })
    )
  • The handler executes the tool logic: reads the post via ApiClient.readPosts for the given team and postNumber, checks if found, returns the post data.
      async (input) =>
        await formatTool(async () => {
          const [response] = await client.readPosts(input.teamName, [
            input.postNumber,
          ])
    
          if (response === undefined) {
            throw new Error("post not found")
          }
    
          return response
        })
    )
  • Input schema validation using Zod: teamName (string with default from env), postNumber (number).
      teamName: z.string().default(getRequiredEnv("DEFAULT_ESA_TEAM")),
      postNumber: z.number(),
    },
  • Supporting ApiClient.readPosts method that fetches post(s) using the generated ESA API client, removes body_html, returns array of post objects. Used by the tool handler.
    async readPosts(teamName: string, postNumbers: readonly number[]) {
      return await Promise.all(
        postNumbers.map(async (postNumber) => {
          const response = await this.callApi(() =>
            getV1TeamsTeamNamePostsPostNumber(
              teamName,
              postNumber,
              {},
              {
                headers: {
                  Authorization: `Bearer ${this.apiKey}`,
                },
              }
            )
          )
          const { body_html, ...others } = response.data
          return others
        })
      )
    }

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/d-kimuson/esa-mcp-server'

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