Skip to main content
Glama

query_matrix

Search for keywords across topics and dates within the Revenue Engine MCP to analyze business data and track revenue-related information.

Instructions

Search Matrix for keyword across topics and dates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYesSearch term
topicsNoTopics to search (optional, defaults to all)
limitNoMax results (default 50)

Implementation Reference

  • Handler for the 'query_matrix' tool. Delegates execution to the external Google Apps Script API via callAPI function with action 'queryMatrix' and tool arguments.
    case "query_matrix":
      result = await callAPI("queryMatrix", args);
      break;
  • index.js:454-476 (registration)
    Registration of the 'query_matrix' tool in the ListTools response, including name, description, and input schema definition.
    {
      name: "query_matrix",
      description: "Search Matrix for keyword across topics and dates",
      inputSchema: {
        type: "object",
        properties: {
          keyword: {
            type: "string",
            description: "Search term"
          },
          topics: {
            type: "array",
            items: { type: "string" },
            description: "Topics to search (optional, defaults to all)"
          },
          limit: {
            type: "number",
            description: "Max results (default 50)"
          }
        },
        required: ["keyword"]
      }
    },
  • Input schema for the 'query_matrix' tool, defining parameters: keyword (required), topics (optional array), limit (optional number).
    inputSchema: {
      type: "object",
      properties: {
        keyword: {
          type: "string",
          description: "Search term"
        },
        topics: {
          type: "array",
          items: { type: "string" },
          description: "Topics to search (optional, defaults to all)"
        },
        limit: {
          type: "number",
          description: "Max results (default 50)"
        }
      },
      required: ["keyword"]
  • Helper function callAPI used by query_matrix handler to make POST request to Google Apps Script endpoint with action 'queryMatrix' and arguments.
    async function callAPI(action, data = {}) {
      debugLog('=== API CALL START ===');
      debugLog(`Action: ${action}`);
      debugLog(`Data: ${JSON.stringify(data)}`);
    
      try {
        // Build form-encoded body for POST
        const formData = new URLSearchParams();
        formData.append('action', action);
    
        // Add all data fields to form
        for (const [key, value] of Object.entries(data)) {
          if (value !== undefined && value !== null) {
            formData.append(key, value.toString());
          }
        }
    
        const formString = formData.toString();
        debugLog(`FormData: ${formString}`);
        debugLog(`API_URL: ${API_URL}`);
    
        // Use POST with proper content type
        const response = await fetch(API_URL, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
          },
          body: formString
        });
    
        debugLog(`Response status: ${response.status}`);
        debugLog(`Response ok: ${response.ok}`);
    
        if (!response.ok) {
          debugLog(`Response not OK: ${response.status} ${response.statusText}`);
          throw new Error(`API request failed: ${response.status} ${response.statusText}`);
        }
    
        const text = await response.text();
        debugLog(`Response text length: ${text.length}`);
        debugLog(`Response text: ${text}`);
    
        if (!text) {
          debugLog('ERROR: Empty response from API');
          throw new Error('Empty response from API');
        }
    
        const parsed = JSON.parse(text);
        debugLog(`Parsed successfully: ${JSON.stringify(parsed)}`);
        debugLog('=== API CALL END ===');
        return parsed;
    
      } catch (error) {
        debugLog(`ERROR in callAPI: ${error.message}`);
        debugLog(`ERROR stack: ${error.stack}`);
        throw error;
      }
    }
Behavior2/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 of behavioral disclosure. While 'Search' implies a read-only operation, the description doesn't address important behavioral aspects like whether this is a real-time search, how results are sorted/ranked, pagination behavior, performance characteristics, or any rate limits. The description is too minimal for a search 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 extremely concise at just 6 words, with zero wasted language. It's front-loaded with the core functionality and efficiently communicates the essential purpose without unnecessary elaboration.

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?

For a search tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what kind of results to expect, the format of returned data, error conditions, or how the search operates across the mentioned 'topics and dates' dimensions. The agent would be left guessing about important behavioral aspects.

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?

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description mentions 'keyword across topics and dates' which aligns with the schema parameters but doesn't add meaningful semantic context beyond what the schema provides. The baseline of 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 as searching the Matrix for a keyword across topics and dates, which is a specific verb+resource combination. However, it doesn't distinguish this tool from potential sibling search tools like 'search_gmail' or 'read_matrix_snapshot' that might have overlapping functionality.

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. With multiple sibling tools that could involve searching or reading data (search_gmail, read_matrix_snapshot, get_matrix_row, etc.), there's no indication of when this specific search tool is appropriate versus other options.

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/PromptishOperations/mcpSpec'

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