Skip to main content
Glama
cremich

promptz.dev MCP Server

by cremich

get_rule

Retrieve a specific project rule by name from promptz.dev to access prompts without context switching in development workflows.

Instructions

Get a specific project rule by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoName of the rule to retrieve

Implementation Reference

  • The primary handler function for the "get_rule" tool. It validates the input name, fetches the rule via getRuleByName, formats the response data, and returns it as a JSON text content block.
    export async function getRuleToolHandler(request: CallToolRequest): Promise<CallToolResult> {
      const name = request.params.arguments?.name as string | undefined;
    
      if (!name) {
        throw new Error("Rule name is required");
      }
      const rule = await getRuleByName(name);
      if (!rule) {
        throw new Error(`Rule not found: ${name}`);
      }
    
      const ruleData = {
        name: rule.name,
        description: rule.description,
        tags: rule.tags || [],
        author: rule.author?.displayName,
        content: rule.content,
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(ruleData, null, 2),
          },
        ],
      };
    }
  • src/index.ts:117-119 (registration)
    Registration in the CallToolRequest switch statement, dispatching calls to the get_rule tool to its handler function.
    case "get_rule": {
      return await getRuleToolHandler(request);
    }
  • src/index.ts:84-96 (registration)
    Tool registration in the ListToolsRequest handler, defining the name, description, and input schema for the "get_rule" tool.
    {
      name: "get_rule",
      description: "Get a specific project rule by name",
      inputSchema: {
        type: "object",
        properties: {
          name: {
            type: "string",
            description: "Name of the rule to retrieve",
          },
        },
      },
    },
  • Supporting helper function that executes the GraphQL query to fetch a project rule by its name, used by the tool handler.
    export async function getRuleByName(name: string): Promise<ProjectRule | null> {
      try {
        logger.info(`[API] Getting rule by name: ${name}`);
    
        // Search for prompts with the exact name
        const { data, error } = await client.query(
          gql`
            ${GET_RULE_BY_NAME}
          `,
          { name },
        );
    
        if (error) {
          throw error;
        }
    
        const rules = data.listRuleByName.items;
        if (rules.length === 0) {
          return null;
        }
    
        return rules[0];
      } catch (error) {
        logger.error(`[Error] Failed to get rule by name: ${error instanceof Error ? error.message : String(error)}`);
        throw new Error(`Failed to get rule by name: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Get') but doesn't describe whether this is a read-only operation, what happens if the rule doesn't exist, permissions required, or response format. This leaves significant gaps for a 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 a single, efficient sentence with no wasted words, clearly front-loading the core action. It's appropriately sized for a simple tool with one parameter.

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 a simple input schema, the description is incomplete. It lacks information on behavioral aspects like error handling, return values, or usage context, which are crucial for effective tool invocation by an AI agent.

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%, with the single parameter 'name' documented in the schema as 'Name of the rule to retrieve'. The description adds no additional parameter details beyond this, so it meets the baseline for high schema coverage without compensating value.

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 verb ('Get') and resource ('a specific project rule by name'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_rules' (which likely lists multiple rules vs. retrieving one specific rule).

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?

No guidance is provided on when to use this tool versus alternatives like 'list_rules' or other siblings. The description implies usage for retrieving a specific rule by name but doesn't clarify prerequisites, error conditions, or comparative contexts.

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/cremich/promptz-mcp'

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