Skip to main content
Glama
AlyssonM

HiveAuth MCP Server

by AlyssonM

create_presentation_definition

Define credential requirements for verifiable presentations by specifying input descriptors and constraints using DIF Presentation Exchange v2.0 standards.

Instructions

Create a DIF Presentation Exchange v2.0 definition for requesting specific credentials. Defines input descriptors and constraints for credential selection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
nameNo
purposeNo
inputDescriptorsYes

Implementation Reference

  • The main handler function that executes the tool logic: validates input using the schema, constructs the DIF PEX v2.0 presentation definition from input descriptors, validates structure (unique IDs, non-empty), generates human-readable summary and JSON output.
    export async function createPresentationDefinition(args: any): Promise<CallToolResult> {
      // Validate and sanitize input
      const validation = validateAndSanitizeInput(CreatePresentationDefinitionInputSchema, args, 'create_presentation_definition');
      
      if (!validation.success) {
        return createValidationErrorResult(validation.error!);
      }
    
      const data = validation.data!;
      const { id, name, purpose, inputDescriptors } = data;
    
      try {
        // Build the presentation definition according to DIF PEX v2.0 spec
        const presentationDefinition = {
          id,
          name,
          purpose,
          input_descriptors: inputDescriptors.map((descriptor: any) => ({
            id: descriptor.id,
            name: descriptor.name,
            purpose: descriptor.purpose,
            constraints: descriptor.constraints || {},
            schema: descriptor.schema || undefined
          }))
        };
    
        // Validate the structure
        if (!presentationDefinition.input_descriptors.length) {
          throw new Error('At least one input descriptor is required');
        }
    
        // Check for duplicate IDs
        const descriptorIds = presentationDefinition.input_descriptors.map((d: any) => d.id);
        const uniqueIds = new Set(descriptorIds);
        if (descriptorIds.length !== uniqueIds.size) {
          throw new Error('Input descriptor IDs must be unique');
        }
    
        const summary = [
          `• Definition ID: ${id}`,
          `• Name: ${name || 'Not specified'}`,
          `• Purpose: ${purpose || 'Not specified'}`,
          `• Input Descriptors: ${inputDescriptors.length}`,
          ''
        ];
    
        inputDescriptors.forEach((descriptor: any, index: number) => {
          summary.push(`Input Descriptor ${index + 1}:`);
          summary.push(`  • ID: ${descriptor.id}`);
          summary.push(`  • Name: ${descriptor.name || 'Not specified'}`);
          summary.push(`  • Purpose: ${descriptor.purpose || 'Not specified'}`);
          
          if (descriptor.constraints?.fields) {
            summary.push(`  • Field Constraints: ${descriptor.constraints.fields.length}`);
            descriptor.constraints.fields.forEach((field: any, fieldIndex: number) => {
              summary.push(`    - Field ${fieldIndex + 1}: ${field.path?.join(', ') || 'No path specified'}`);
            });
          }
          summary.push('');
        });
    
        return {
          content: [
            {
              type: 'text',
              text: `Created Presentation Definition:\n\n${summary.join('\n')}`
            },
            {
              type: 'text',
              text: `\`\`\`json\n${JSON.stringify(presentationDefinition, null, 2)}\n\`\`\``
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Failed to create presentation definition: ${error.message}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod input schema definition for the create_presentation_definition tool, validating required ID and at least one input descriptor, with optional name and purpose.
    export const CreatePresentationDefinitionInputSchema = z.object({
      id: z.string().min(1, 'Presentation definition ID is required'),
      name: z.string().optional(),
      purpose: z.string().optional(),
      inputDescriptors: z.array(InputDescriptorSchema).min(1, 'At least one input descriptor is required')
    });
  • Tool registration in TOOL_DEFINITIONS array: specifies name, description, and references the input schema for generating MCP Tool objects advertised to clients.
    name: 'create_presentation_definition',
    description: 'Create a DIF Presentation Exchange v2.0 definition for requesting specific credentials. Defines input descriptors and constraints for credential selection.',
    inputSchema: TOOL_SCHEMAS.create_presentation_definition
  • src/index.ts:95-96 (registration)
    Handler dispatch in the main switch statement: routes 'create_presentation_definition' tool calls to the createPresentationDefinition function.
    case 'create_presentation_definition':
      return await createPresentationDefinition(args);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a creation tool but doesn't describe what happens after creation (e.g., where definitions are stored, whether they're persisted, permissions required, or error conditions). For a tool with complex parameters and no annotations, this is a significant gap in behavioral context.

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 appropriately concise with two sentences that efficiently convey the core purpose. It's front-loaded with the main action and avoids unnecessary elaboration. Every sentence contributes to understanding the tool's function.

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 complex tool with 4 parameters (2 required), nested objects, 0% schema description coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain parameter meanings, expected outputs, error handling, or behavioral implications. The agent lacks sufficient context to use this tool effectively.

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%, so the description must compensate but only mentions 'input descriptors and constraints' generically. It doesn't explain the purpose or relationships of the 4 parameters (id, name, purpose, inputDescriptors) or their nested structures. The description adds minimal value beyond what's inferable from parameter names in the schema.

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 creates a DIF Presentation Exchange v2.0 definition for requesting specific credentials, specifying both the verb ('Create') and resource ('definition'). It distinguishes from siblings by focusing on definition creation rather than credential operations like issue/verify/revoke, though it doesn't explicitly contrast with 'validate_presentation_definition' which validates rather than creates.

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 doesn't mention prerequisites, appropriate contexts, or contrast with sibling tools like 'validate_presentation_definition' or 'generate_presentation_request'. The agent must infer usage from the purpose alone.

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/AlyssonM/hiveauth-mcp'

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