extending-function-params

A set of repository rules for adding or changing parameters passed to a function. It covers the validation schema, implementation, documentation, and tests.

In plain words
What is it for?
Add typed and validated parameters, pass optional values safely, document their usage and limits, and update the related tests.
Why use it?
It keeps new parameters consistent across validation, function calls, user-facing instructions, and test coverage.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/commercetools/mcp-essentials/extending-function-params
Clone the repo
git clone --depth 1 https://github.com/commercetools/mcp-essentials

Made for: Cursor.

Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 600 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.00600
Opus 5 $0.00006 $0.00300
Sonnet 5 $0.00002 $0.00120
Haiku 4.5 $0.00001 $0.00060

Measured yesterday against content hash 3c7de024b27d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

extending-function-params scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/extending-function-params.mdc · 87 lines

What it actually says

Always follow these steps in order:

  1. Parameter Schema Update:

    • Locate the parameters file (usually typescript/src/shared/(namespace)/parameters.ts)
    • Add new parameters to the Zod schema
    • For each parameter:
      • Define the correct type (e.g., z.number(), z.array(z.string()))
      • Add appropriate validations (e.g., .min(), .max())
      • Mark as .optional() if not required
      • Add .describe() with clear documentation
      • Include examples in the description for complex types
  2. Function Implementation Update:

    • Locate the function file (usually typescript/src/shared/(namespace)/functions.ts)
    • Add new parameters to the queryArgs object
    • Use spread operator with null checks for optional params
    • Format: ...(params.newParam && {newParam: params.newParam})
    • Remove any outdated comments
  3. Documentation Update:

    • Locate the prompts file (usually named typescript/src/shared/(namespace)/prompts.ts)
    • Update the function's prompt string
    • For each parameter add:
      • Parameter name
      • Type information
      • Optional/required status
      • Default value if any
      • Valid range if applicable
      • Example usage for complex types
  4. Test Coverage Update:

    • Locate the test file (usually typescript/src/shared/(namespace)/test/functions.test.ts)
    • Add/update test cases:
      • Test with default parameters
      • Test with all new parameters
      • Test error scenarios
    • Verify all parameters are correctly passed to the API
    • Ensure proper mock setup and assertions
  5. Verification:

    • Ensure all files are consistent with each other
    • Parameter types match between schema and tests
    • Examples in prompts match test cases
    • All optional parameters handle undefined cases
    • Error handling is properly tested

Example: When adding 'offset' parameter:

  1. In parameters.ts:

    offset: z
      .number()
      .int()
      .min(0)
      .optional()
      .describe('The number of items to skip before starting to collect the result set.')
    
  2. In functions.ts:

    queryArgs: {
      ...(params.offset && {offset: params.offset}),
    }
    
  3. In prompts.ts:

    - offset (int, optional): The number of items to skip before starting to collect the result set.
    
  4. In functions.test.ts:

    it('should list products with all query parameters', async () => {
      const params = {
        offset: 40,
        // other params...
      };
      // test implementation
    });
    
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 87 lines · 600 tokens per session scan A 3c7de024b27d

Subscribe to this mod's changes

extending-function-params is a cursor rule published in the GitHub repository commercetools/mcp-essentials (13 stars, last pushed 15d ago), licensed MIT. It adds 12 tokens to every session and 600 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.