Skip to main content
Glama
pythagraph

Pythagraph RED MCP Server

by pythagraph

get_graph_summary

Generate a concise summary of graph data, including overview statistics, node/edge type distributions, and key insights. Optionally include detailed node and edge information for comprehensive analysis using the Pythagraph RED API.

Instructions

Get a concise summary of graph data from Pythagraph RED API. Provides overview statistics, node/edge type distributions, and key insights without overwhelming detail. Use includeDetails=true for more comprehensive analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
graphIdYesThe unique identifier for the graph to get summary
includeDetailsNoInclude detailed node and edge information

Implementation Reference

  • Handler logic for the get_graph_summary tool within the CallToolRequestSchema handler: parses arguments, fetches graph data using fetchGraphData, formats the summary using formatGraphSummary, and returns the text content.
    case "get_graph_summary": {
      const parsed = GetGraphSummaryArgsSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments for get_graph_summary: ${parsed.error}`);
      }
    
      const graphData = await fetchGraphData(parsed.data.graphId);
      const summary = formatGraphSummary(graphData, parsed.data.includeDetails);
    
      return {
        content: [{ type: "text", text: summary }],
      };
    }
  • Zod schema defining the input parameters for the get_graph_summary tool: graphId (required string) and includeDetails (optional boolean, default false).
    const GetGraphSummaryArgsSchema = z.object({
      graphId: z.string().describe('The unique identifier for the graph to get summary'),
      includeDetails: z.boolean().default(false).describe('Include detailed node and edge information'),
    });
  • index.ts:264-268 (registration)
    Registration of the get_graph_summary tool in the ListToolsRequestSchema response, specifying name, description, and derived JSON schema from Zod.
    {
      name: "get_graph_summary",
      description: "Get a concise summary of graph data from Pythagraph RED API. Provides overview statistics, node/edge type distributions, and key insights without overwhelming detail. Use includeDetails=true for more comprehensive analysis.",
      inputSchema: zodToJsonSchema(GetGraphSummaryArgsSchema) as ToolInput,
    },
  • Helper function specifically used by get_graph_summary to format PythagraphResponse data into a markdown summary, including basic info, description, key insights (max/min values), and optionally full table details via formatGraphDataAsTable.
    function formatGraphSummary(data: PythagraphResponse, includeDetails: boolean = false): string {
      let result = "";
    
      result += `# ${data.graphNm} - 요약\n\n`;
    
      // 기본 정보
      result += `📊 **Graph ID**: ${data.graphId}\n`;
      result += `📊 **데이터 건수**: ${data.graphData.length}건\n`;
      result += `📊 **단위**: ${data.unitDivNm} (${data.unitNm})\n`;
      result += `📅 **등록일**: ${data.regTime}\n\n`;
    
      // 설명
      if (data.graphDet) {
        const cleanDescription = data.graphDet
          .replace(/<[^>]*>/g, '')
          .replace(/"/g, '"')
          .replace(//g, '')
          .trim();
        result += `**설명**: ${cleanDescription}\n\n`;
      }
    
      // 빠른 통계
      if (data.graphData && data.graphData.length > 0) {
        const valueColumnIndex = data.cols.findIndex(col => col.includes('값'));
        
        if (valueColumnIndex !== -1) {
          const values = data.graphData
            .map(row => parseFloat(row[valueColumnIndex]))
            .filter(val => !isNaN(val));
          
          if (values.length > 0) {
            const total = values.reduce((sum, val) => sum + val, 0);
            const max = Math.max(...values);
            const min = Math.min(...values);
            
            // 최고값과 최저값 항목 찾기
            const maxIndex = data.graphData.findIndex(row => parseFloat(row[valueColumnIndex]) === max);
            const minIndex = data.graphData.findIndex(row => parseFloat(row[valueColumnIndex]) === min);
            
            result += "## 🔍 핵심 인사이트\n\n";
            if (maxIndex !== -1) {
              const categoryIndex = data.cols.findIndex(col => col.includes('MBTI') || col.includes('유형'));
              const maxCategory = categoryIndex !== -1 ? data.graphData[maxIndex][categoryIndex] : data.graphData[maxIndex][1];
              result += `🏆 **최고**: ${maxCategory} (${(max * 100).toFixed(1)}%)\n`;
            }
            if (minIndex !== -1) {
              const categoryIndex = data.cols.findIndex(col => col.includes('MBTI') || col.includes('유형'));
              const minCategory = categoryIndex !== -1 ? data.graphData[minIndex][categoryIndex] : data.graphData[minIndex][1];
              result += `📉 **최저**: ${minCategory} (${(min * 100).toFixed(1)}%)\n`;
            }
            result += `📊 **총합**: ${(total * 100).toFixed(1)}%\n\n`;
          }
        }
      }
    
      if (includeDetails) {
        result += "\n---\n\n" + formatGraphDataAsTable(data);
      } else {
        result += "\n*`includeDetails: true` 옵션을 사용하면 전체 데이터 테이블을 볼 수 있습니다.*\n";
      }
    
      return result;
    }
  • Shared helper function to fetch graph data from the Pythagraph RED API endpoint, used by both get_graph_data and get_graph_summary tools.
    async function fetchGraphData(graphId: string): Promise<PythagraphResponse> {
      const url = `${API_BASE_URL}?graphId=${encodeURIComponent(graphId)}`;
      
      try {
        const response = await fetch(url, {
          method: 'GET',
          headers: {
            'Accept': 'application/json',
            'User-Agent': 'MCP-PythagraphRED-Server/0.1.0',
          },
    //      timeout: 30000, // 30 second timeout
        });
    
        if (!response.ok) {
          throw new Error(`HTTP ${response.status}: ${response.statusText}`);
        }
    
        const data = await response.json() as PythagraphResponse;
        
        if (data.message !== 'OK') {
          throw new Error(`API Error: ${data.message}`);
        }
        
        return data;
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Failed to fetch graph data: ${error.message}`);
        }
        throw new Error('Failed to fetch graph data: Unknown error');
      }
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool provides a 'concise summary' and mentions an optional parameter for more details, but it lacks information on behavioral traits such as permissions required, rate limits, error handling, or response format. The description doesn't contradict annotations, but it's insufficient for a mutation tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with two sentences that efficiently convey the tool's purpose and usage. Every sentence earns its place by providing essential information without redundancy or waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (read operation with 2 parameters, no output schema), the description is somewhat complete but has gaps. It explains the purpose and basic usage, but without annotations or output schema, it lacks details on behavioral aspects like response format, error cases, or integration with the sibling tool. This is adequate but not fully comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('graphId' and 'includeDetails'). The description adds some value by explaining that 'includeDetails=true' enables 'more comprehensive analysis', but it doesn't provide additional syntax, format details, or examples beyond what the schema provides. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('graph data from Pythagraph RED API'), and it distinguishes the tool by specifying it provides a 'concise summary' with 'overview statistics, node/edge type distributions, and key insights without overwhelming detail'. However, it doesn't explicitly differentiate from the sibling tool 'get_graph_data', which likely provides more detailed data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use this tool: for a 'concise summary' with 'overview statistics' and 'key insights without overwhelming detail'. It also mentions an alternative usage mode ('Use includeDetails=true for more comprehensive analysis'), but it doesn't explicitly state when to use this tool versus the sibling 'get_graph_data' or provide exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/pythagraph/pythagraph-red-mcp'

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