Skip to main content
Glama
Seitrace

Seitrace Insights MCP Server

Official
by Seitrace

get_resource_action_snippet

Generate code snippets to execute resource actions in multiple programming languages. Simplify API integrations by providing ready-to-use code for JavaScript, Python, Java, and more.

Instructions

Generate a code snippet to perform a resource action in the specified language. For example, a JavaScript snippet to call the action with the required parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
languageYes
resourceYes

Implementation Reference

  • The primary handler function for the 'get_resource_action_snippet' tool. It resolves the topic from the resource name, validates the resource and action existence, and delegates to the topic's getResourceActionSnippet method to generate the code snippet.
    export const getResourceActionSnippetHandler = async (
      toolArgs: GetSnippetToolArgs
    ): Promise<CallToolResult> => {
      const { resource, action } = toolArgs;
      const topicKey = resource.split('_')[0];
      const foundResource = TOPIC_KEY_MAP[topicKey] || TOPIC_KEY_MAP[resource];
    
      /**
       * Check if the resource exists
       */
      if (
        !foundResource ||
        !(await foundResource.getResources()).has(resource) ||
        !(await foundResource.hasResourceAction(resource, action!))
      ) {
        return McpResponse(
          JSON.stringify({ error: `Unknown or missing resource '${resource}' or action '${action}'.` })
        );
      }
    
      /**
       * List actions for the resource
       */
      return foundResource.getResourceActionSnippet(toolArgs);
    };
  • JSON input schema definition for the tool, provided in the tools list response. Specifies required parameters: resource, action, language.
    const listResourceActionSnippet: Tool = {
      name: GET_RESOURCE_ACTION_SNIPPET_TOOL,
      description:
        'Generate a code snippet to perform a resource action in the specified language (optional tool for developers). Shows how to call the action with the required parameters. Useful for integrating Seitrace API calls into your own applications.',
      inputSchema: {
        type: 'object',
        properties: {
          resource: { type: 'string' },
          action: { type: 'string' },
          language: { type: 'string' },
          payload: {
            type: 'object',
            additionalProperties: true,
            description:
              'Optional example payload for snippet generation (e.g., rpc_method, params, endpoint).',
          },
        },
        required: ['resource', 'action', 'language'],
        additionalProperties: false,
        description: `Provide resource, action, and target language. Supported languages: ${SUPPORTED_SNIPPET_LANGUAGES.join(
          ', '
        )}`,
      },
    };
  • Registers the getResourceActionSnippetHandler under the tool name GET_RESOURCE_ACTION_SNIPPET_TOOL in the central handler map.
    export const handlerMap = {
      [LIST_RESOURCES_TOOL]: listResourcesHandler,
      [LIST_RESOURCE_ACTIONS_TOOL]: listResourceActionsHandler,
      [GET_RESOURCE_ACTION_SCHEMA_TOOL]: getResourceActionSchemaHandler,
      [GET_RESOURCE_ACTION_SNIPPET_TOOL]: getResourceActionSnippetHandler,
      [INVOKE_RESOURCE_ACTION_TOOL]: invokeResourceActionHandler,
    };
  • TypeScript interface defining the input arguments for snippet tools, extending ToolArgs with optional language.
    export interface GetSnippetToolArgs extends ToolArgs {
      /**
       * The programming language to use for code snippets
       */
      language?: string;
    }
  • src/constants.ts:23-23 (registration)
    Defines the constant string name for the tool.
    export const GET_RESOURCE_ACTION_SNIPPET_TOOL = 'get_resource_action_snippet';
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. It mentions generating a code snippet but doesn't cover critical aspects such as whether this is a read-only operation, if it requires authentication, potential rate limits, error handling, or the format of the output. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, stating the core purpose in the first sentence. The second sentence provides a helpful example without unnecessary elaboration. However, it could be slightly more structured by explicitly separating parameter explanations, but overall, it avoids waste and is appropriately sized for the tool's complexity.

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 the tool's complexity (3 parameters, no annotations, no output schema), the description is incomplete. It lacks details on output format, error cases, dependencies on other tools (e.g., needing to list resources first), and behavioral traits. Without annotations or an output schema, the description should provide more context to fully guide an AI agent, but it falls short.

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 0%, meaning the schema provides no descriptions for parameters. The description adds minimal semantics by mentioning 'resource, action, and target language' and listing supported languages in the schema, but it doesn't explain what 'resource' or 'action' refer to, their expected formats, or how they interact. This insufficient detail fails to compensate for the low schema coverage.

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: 'Generate a code snippet to perform a resource action in the specified language.' It includes a specific verb ('Generate') and resource ('code snippet'), and the example adds clarity. However, it doesn't explicitly differentiate from sibling tools like 'invoke_resource_action' or 'get_resource_action_schema', which is why it doesn't achieve a perfect score.

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. It mentions an example but doesn't specify contexts, prerequisites, or exclusions relative to siblings like 'invoke_resource_action' (which might execute actions directly) or 'get_resource_action_schema' (which might provide schema details). This lack of comparative guidance limits its utility for an AI agent.

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

Related 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/Seitrace/seitrace-mcp'

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