Skip to main content
Glama
Shaveen12

CSE MCP Server

by Shaveen12

Get Market Summary

get_market_summary

Retrieve the overall market summary for the Colombo Stock Exchange, including total trade volume, share volume, and trade date.

Instructions

Get the overall market summary including total trade volume, share volume, and trade date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function `getMarketSummary()` that fetches market summary data from the CSE API (https://www.cse.lk/api/marketSummery) and returns trade volume, share volume, and trade date.
    async function getMarketSummary() {
      try {
        const response = await axios.post(
          'https://www.cse.lk/api/marketSummery',
          {},
          {
            headers: {
              'Content-Type': 'application/json'
            },
            timeout: 10000
          }
        );
        
        const data = response.data || {};
        
        return {
          tradeVolume: data.tradeVolume,
          shareVolume: data.shareVolume,
          tradeDate: data.tradeDate ? new Date(data.tradeDate).toISOString() : null
        };
      } catch (error: any) {
        if (error.code === 'ECONNABORTED') {
          throw new Error('Request timed out. Please try again.');
        } else if (error.response) {
          throw new Error(`API error: ${error.response.status} - ${error.response.statusText}`);
        } else {
          throw new Error(`Network error: ${error.message}`);
        }
      }
    }
  • The schema/registration for the 'get_market_summary' tool, defining its title, description, and empty inputSchema (no inputs required).
    {
      title: "Get Market Summary",
      description: "Get the overall market summary including total trade volume, share volume, and trade date.",
      inputSchema: {}
    },
  • src/index.ts:596-629 (registration)
    The registration of the 'get_market_summary' tool on the MCP server via `server.registerTool()`, including the handler that calls getMarketSummary() and formats the response.
    server.registerTool(
      "get_market_summary",
      {
        title: "Get Market Summary",
        description: "Get the overall market summary including total trade volume, share volume, and trade date.",
        inputSchema: {}
      },
      async () => {
        try {
          const marketSummary = await getMarketSummary();
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                title: "Market Summary",
                tradeVolume: marketSummary.tradeVolume ? `Rs. ${marketSummary.tradeVolume.toLocaleString()}` : 'N/A',
                shareVolume: marketSummary.shareVolume?.toLocaleString() || 'N/A',
                tradeDate: marketSummary.tradeDate || 'N/A',
                lastUpdated: new Date().toISOString()
              }, null, 2)
            }]
          };
        } catch (error: any) {
          return {
            content: [{
              type: "text",
              text: `Error fetching market summary: ${error.message}`
            }],
            isError: true
          };
        }
      }
    );
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses the output fields (volume, date) and implies a read-only action. Given the tool's simplicity (no params), the description is adequate but could mention data freshness or scope.

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?

One concise sentence that directly conveys purpose and primary outputs. No wasted words.

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?

For a zero-parameter tool with no output schema or annotations, the description is minimal. It covers the basic purpose but lacks depth about output structure, data recency, or any caveats. Could be more complete.

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

Parameters4/5

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

There are no parameters, so schema coverage is 100%. The description adds no parameter details, but none are needed. Baseline for 0 params is 4.

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

Purpose5/5

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

The description clearly states it gets the overall market summary and specifies included fields (total trade volume, share volume, trade date). This distinctly separates it from sibling tools that focus on individual companies or filtered lists.

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

Usage Guidelines3/5

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

The description implies use for broad market overview but does not explicitly state when to use versus siblings or provide exclusions. The context of sibling tools helps but is not spelled out.

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

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/Shaveen12/cse-mcp'

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