Skip to main content
Glama
owen-lacey

FPL MCP Server

by owen-lacey

getElementSummary

Fetch player details and statistics from Fantasy Premier League data using the official FPL API to support team management decisions.

Instructions

Fetch details for a specific player (element)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementIdYes

Implementation Reference

  • src/server.ts:267-281 (registration)
    Registration of the MCP tool 'getElementSummary' including title, description, input schema, and an inline asynchronous handler function.
    server.registerTool("getElementSummary", {
      title: "Get Element Summary",
      description: "Fetch details for a specific player (element)",
      inputSchema: { elementId: z.number() }
    }, async ({ elementId }) => {
      const data = await getElementSummary(elementId);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data)
          }
        ]
      };
    });
  • Zod-based input schema requiring an 'elementId' number parameter.
    inputSchema: { elementId: z.number() }
  • The tool's handler logic: calls the getElementSummary helper with elementId, stringifies the data as JSON, and returns it in the standard MCP content format.
    }, async ({ elementId }) => {
      const data = await getElementSummary(elementId);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data)
          }
        ]
      };
    });
  • Helper function implementing the core logic: fetches player (element) summary data from the official Fantasy Premier League API endpoint.
    export async function getElementSummary(elementId: number): Promise<any> {
      const res = await fetch(`https://fantasy.premierleague.com/api/element-summary/${elementId}/`);
      return res.json();
    }

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/owen-lacey/fpl-mcp'

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