Skip to main content
Glama
Luminaire1337

MTA:SA Documentation MCP Server

list_functions_by_category

List all canonical functions and events in a selected category. Helps discover specific API elements when search terms are unclear.

Instructions

Enumerate canonical function/event names in a category. Useful for discovery when query terms are vague.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesThe category to list functions from
limitNoMaximum number of results to return

Implementation Reference

  • src/index.ts:557-595 (registration)
    Registration of the 'list_functions_by_category' tool with MCP server, including inputSchema (category enum, limit) and the handler callback.
    // Register tool: list_functions_by_category
    server.registerTool(
      "list_functions_by_category",
      {
        description:
          "Enumerate canonical function/event names in a category. Useful for discovery when query terms are vague.",
        inputSchema: {
          category: z
            .enum(FUNCTION_CATEGORIES)
            .describe("The category to list functions from"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(500)
            .optional()
            .default(100)
            .describe("Maximum number of results to return"),
        },
      },
      async ({ category, limit }): Promise<CallToolResult> => {
        const results = listFunctionsByCategory(category, limit);
        const formatted = results.map(
          (f: MtasaFunction) => `${f.name} [${f.side}]`,
        );
    
        const body =
          formatted.length > 0 ? formatted.join("\n") : "No functions found.";
    
        return {
          content: [
            {
              type: "text",
              text: `MTA:SA functions in category "${category}" (showing ${results.length}):\n\n${body}`,
            },
          ],
        };
      },
    );
  • Handler callback for the tool: calls listFunctionsByCategory from queries, formats results as text, and returns CallToolResult.
      async ({ category, limit }): Promise<CallToolResult> => {
        const results = listFunctionsByCategory(category, limit);
        const formatted = results.map(
          (f: MtasaFunction) => `${f.name} [${f.side}]`,
        );
    
        const body =
          formatted.length > 0 ? formatted.join("\n") : "No functions found.";
    
        return {
          content: [
            {
              type: "text",
              text: `MTA:SA functions in category "${category}" (showing ${results.length}):\n\n${body}`,
            },
          ],
        };
      },
    );
  • InputSchema for the tool: 'category' (enum of FUNCTION_CATEGORIES) and optional 'limit' (1-500, default 100).
    inputSchema: {
      category: z
        .enum(FUNCTION_CATEGORIES)
        .describe("The category to list functions from"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(500)
        .optional()
        .default(100)
        .describe("Maximum number of results to return"),
    },
  • Helper function listFunctionsByCategory that queries the database by category with a clamped limit, returns MtasaFunction[].
    export const listFunctionsByCategory = (
      category: string,
      limit: number = 100,
    ): MtasaFunction[] => {
      const safeLimit = clampLimit(limit, 100, 500);
      const rows = queries.getByCategory().all(category, safeLimit);
      return rows as MtasaFunction[];
    };
  • SQL prepared statement getByCategory: SELECT * FROM function_metadata WHERE category = ? ORDER BY name COLLATE NOCASE LIMIT ?.
    getByCategory: () =>
      db.prepare(`
      SELECT * FROM function_metadata WHERE category = ? ORDER BY name COLLATE NOCASE LIMIT ?
    `),
Behavior2/5

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

No annotations provided, and the description does not disclose behavioral traits such as whether the tool is read-only, has side effects, or requires authentication. While listing is likely safe, the description relies on inference.

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 that are front-loaded with the primary action, with no extraneous information. Every word adds value.

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?

The description is complete enough for this simple list tool, given the schema covers both parameters. It differentiates from sibling tools and is adequate for agent selection.

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 coverage is 100%, so the baseline is 3. The description does not add extra meaning beyond what the schema provides for 'category' and 'limit'; the schema already sufficiently describes their purpose.

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?

Description clearly states 'Enumerate canonical function/event names in a category', with a specific verb (enumerate) and resource (canonical function/event names in a category), distinguishing it from sibling tools that search or find specific functions.

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?

Provides clear usage context: 'Useful for discovery when query terms are vague', which helps an agent know when to choose this tool, though it does not explicitly state when not to use it or name alternatives.

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/Luminaire1337/mtasa-docs-mcp'

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