Skip to main content
Glama
BACH-AI-Tools

Finmap MCP Server

Market overview

get_market_overview

Retrieve market cap, volume, and sector performance data for specific stock exchanges on chosen dates to analyze historical market conditions.

Instructions

Get total market cap, volume, value, and performance for an exchange on a specific date with a sector breakdown.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stockExchangeYesStock exchange: amex, nasdaq, nyse, us-all, lse, moex, bist, hkex
yearNo
monthNo
dayNo

Implementation Reference

  • The handler function for the 'get_market_overview' tool. It fetches market data for the given exchange and date, filters sector items, aggregates market totals and sector metrics (marketCap, volume, value, numTrades, change %), and returns a formatted response including charts links.
    async ({
    	stockExchange,
    	year,
    	month,
    	day,
    }: {
    	stockExchange: StockExchange;
    	year?: number;
    	month?: number;
    	day?: number;
    }) => {
    	try {
    		const formattedDate = getDate(year, month, day);
    		const marketDataResponse = await fetchMarketData(
    			stockExchange,
    			formattedDate,
    		);
    
    		const sectorItems = marketDataResponse.securities.data.filter(
    			(item: any) => item[INDICES.TYPE] === "sector",
    		);
    
    		let marketTotal = {};
    		const sectors: any[] = [];
    
    		sectorItems.forEach((item: any) => {
    			const sectorData = {
    				name: item[INDICES.TICKER],
    				marketCap: item[INDICES.MARKET_CAP],
    				marketCapChangePct: item[INDICES.PRICE_CHANGE_PCT],
    				volume: item[INDICES.VOLUME],
    				value: item[INDICES.VALUE],
    				numTrades: item[INDICES.NUM_TRADES],
    				itemsPerSector: item[INDICES.ITEMS_PER_SECTOR],
    			};
    
    			if (item[INDICES.SECTOR] === "") {
    				marketTotal = sectorData;
    			} else {
    				sectors.push(sectorData);
    			}
    		});
    
    		return createResponse({
    			info: INFO,
    			charts: createCharts(stockExchange, formattedDate),
    			date: formattedDate,
    			exchange: stockExchange.toUpperCase(),
    			currency: EXCHANGE_INFO[stockExchange as StockExchange].currency,
    			marketTotal,
    			sectors,
    		});
    	} catch (error) {
    		return createErrorResponse(error);
    	}
    },
  • Input schema and metadata (title, description) for the 'get_market_overview' tool, referencing shared exchangeSchema and dateSchema.
    {
    	title: "Market overview",
    	description:
    		"Get total market cap, volume, value, and performance for an exchange on a specific date with a sector breakdown.",
    	inputSchema: { stockExchange: exchangeSchema, ...dateSchema },
    },
  • src/core.ts:482-546 (registration)
    The server.registerTool call that registers the 'get_market_overview' tool within the registerFinmapTools function.
    server.registerTool(
    	"get_market_overview",
    	{
    		title: "Market overview",
    		description:
    			"Get total market cap, volume, value, and performance for an exchange on a specific date with a sector breakdown.",
    		inputSchema: { stockExchange: exchangeSchema, ...dateSchema },
    	},
    	async ({
    		stockExchange,
    		year,
    		month,
    		day,
    	}: {
    		stockExchange: StockExchange;
    		year?: number;
    		month?: number;
    		day?: number;
    	}) => {
    		try {
    			const formattedDate = getDate(year, month, day);
    			const marketDataResponse = await fetchMarketData(
    				stockExchange,
    				formattedDate,
    			);
    
    			const sectorItems = marketDataResponse.securities.data.filter(
    				(item: any) => item[INDICES.TYPE] === "sector",
    			);
    
    			let marketTotal = {};
    			const sectors: any[] = [];
    
    			sectorItems.forEach((item: any) => {
    				const sectorData = {
    					name: item[INDICES.TICKER],
    					marketCap: item[INDICES.MARKET_CAP],
    					marketCapChangePct: item[INDICES.PRICE_CHANGE_PCT],
    					volume: item[INDICES.VOLUME],
    					value: item[INDICES.VALUE],
    					numTrades: item[INDICES.NUM_TRADES],
    					itemsPerSector: item[INDICES.ITEMS_PER_SECTOR],
    				};
    
    				if (item[INDICES.SECTOR] === "") {
    					marketTotal = sectorData;
    				} else {
    					sectors.push(sectorData);
    				}
    			});
    
    			return createResponse({
    				info: INFO,
    				charts: createCharts(stockExchange, formattedDate),
    				date: formattedDate,
    				exchange: stockExchange.toUpperCase(),
    				currency: EXCHANGE_INFO[stockExchange as StockExchange].currency,
    				marketTotal,
    				sectors,
    			});
    		} catch (error) {
    			return createErrorResponse(error);
    		}
    	},
    );
  • Helper function fetchMarketData used by the handler to retrieve market data JSON from GitHub for the specified exchange and date.
    async function fetchMarketData(
    	stockExchange: StockExchange,
    	formattedDate: string,
    ): Promise<{ securities: { data: any[][] } }> {
    	const country = EXCHANGE_TO_COUNTRY_MAP[stockExchange];
    	const date = formattedDate.replaceAll("-", "/");
    	const url = `${DATA_BASE_URL}/data-${country}/refs/heads/main/marketdata/${date}/${stockExchange}.json`;
    
    	const response = await fetch(url);
    	if (response.status === 404) {
    		throw new Error(
    			`Not found, try another date. The date must be on or after ${EXCHANGE_INFO[stockExchange].availableSince} for ${stockExchange}`,
    		);
    	}
    
    	return response.json();
    }
Behavior2/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 describes what data is returned but doesn't disclose behavioral traits like whether this is a read-only operation (implied by 'Get' but not explicit), whether it requires authentication, rate limits, error conditions, or what happens with invalid dates. For a tool with 4 parameters and no annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence that front-loads the key information: what data is retrieved and for what scope. Every word earns its place with no redundancy or fluff, making it easy for an agent to parse quickly.

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

Completeness2/5

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

Given no annotations, no output schema, and low schema description coverage (25%), the description is incomplete. It doesn't explain the return format (e.g., structure of sector breakdown), error handling, or prerequisites. For a tool with 4 parameters that returns complex market data, this leaves significant gaps for an agent to use it correctly.

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

Parameters2/5

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

Schema description coverage is only 25% (only 'stockExchange' has a description), so the description must compensate. It mentions 'exchange on a specific date' which hints at the date parameters but doesn't explain the year/month/day structure, valid ranges beyond schema minimums/maximums, or that only stockExchange is required. The description adds minimal value beyond the schema, failing to adequately document the 3 date parameters.

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 action ('Get') and the specific data returned (total market cap, volume, value, performance, sector breakdown) for a specific resource (exchange on a specific date). It distinguishes from siblings like 'get_company_profile' or 'get_sectors_overview' by focusing on exchange-level market metrics rather than company or sector details. However, it doesn't explicitly contrast with 'get_stock_data' which might overlap in some metrics.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_sectors_overview' or 'get_stock_data'. It mentions 'sector breakdown' but doesn't explain if this is more detailed than the sibling 'get_sectors_overview'. There are no explicit when-to-use or when-not-to-use statements, leaving the agent to infer context from tool names alone.

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/BACH-AI-Tools/bach-finmap-mcp'

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