Skip to main content
Glama
kosminus

querywise-mcp

add_metric

Define a reusable SQL aggregate metric (KPI) like revenue or default rate for quantitative analysis. Returns the metric's ID and name.

Instructions

Define a metric: a named, reusable SQL aggregate (a KPI).

Use for quantitative measures like revenue or default rate so grounding and generation can reuse them; for phrase-to-SQL mappings use add_glossary_term instead. Returns the new metric's id and name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionYesTarget database connection — its name or id (case-insensitive). List the available connections with list_connections.
metric_nameYesMachine-friendly metric identifier (e.g. 'gross_revenue').
display_nameYesHuman-friendly metric label (e.g. 'Gross Revenue').
sql_expressionYesSQL aggregate expression implementing the metric (e.g. SUM(amount)).
descriptionNoOptional explanation of what the metric measures.
related_tablesNoOptional list of table names the metric is computed from.
dimensionsNoOptional dimensions to group the metric by (e.g. ['region','month']).
Behavior4/5

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

Annotations already indicate it's not read-only or idempotent. The description adds that it returns the new metric's id and name, which is helpful but doesn't disclose other behaviors like duplicate handling or permission requirements.

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?

Two concise sentences, front-loaded with the core purpose and clear usage guidance. No unnecessary words.

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

Completeness4/5

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

Given the high schema coverage and annotations, the description provides a complete high-level understanding. However, it lacks notes on prerequisites (e.g., connection must exist) or error handling, which would make it slightly more complete.

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 description adds little beyond what the schema already provides for parameters. No new semantic information is given.

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 the tool defines a metric as a reusable SQL aggregate (KPI) and distinguishes it from the sibling tool add_glossary_term by specifying that the latter is for phrase-to-SQL mappings.

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

Usage Guidelines5/5

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

Explicitly tells when to use this tool (for quantitative measures like revenue) and when to use the alternative (add_glossary_term for phrase-to-SQL mappings), providing clear guidance.

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/kosminus/querywise-mcp'

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