Skip to main content
Glama
aaronsb

Jira Insights MCP

manage_jira_insight_schema

Perform CRUD operations on Jira Insights object schemas, including get, list, create, update, and delete, to manage asset schema configurations efficiently. Supports optional fields for enhanced responses.

Instructions

Manage Jira Insights object schemas with CRUD operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoDescription of the schema. Optional for create/update.
expandNoOptional fields to include in the response
maxResultsNoMaximum number of schemas to return. Used for list operation. Can also use snake_case "max_results".
nameNoName of the schema. Required for create operation, optional for update.
operationYesOperation to perform on the schema
schemaIdNoThe ID of the schema. Required for get, update, and delete operations. Can also use snake_case "schema_id".
startAtNoIndex of the first schema to return (0-based). Used for list operation. Can also use snake_case "start_at".

Implementation Reference

  • The setupSchemaHandlers function implements the core logic for the 'manage_jira_insight_schema' tool, handling CRUD operations (get, list, create, update, delete) on Jira Insight schemas via the Jira Assets API, with schema cache management and error handling.
    export async function setupSchemaHandlers(
      server: Server,
      jiraClient: JiraClient,
      schemaCacheManager: SchemaCacheManager,
      request: any
    ): Promise<ToolResponse> {
      const { arguments: args } = request.params;
      const operation = args.operation as SchemaOperation;
    
      // Normalize parameter names (support both camelCase and snake_case)
      const schemaId = args.schemaId || args.schema_id;
      const startAt = args.startAt || args.start_at || 0;
      const maxResults = args.maxResults || args.max_results || 50;
    
      try {
        const assetsApi = await jiraClient.getAssetsApi();
    
        switch (operation) {
        case 'get': {
          if (!schemaId) {
            throw new McpError(ErrorCode.InvalidParams, 'Schema ID is required for get operation');
          }
    
          const schema = await assetsApi.schemaFind({ id: schemaId });
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(schema, null, 2),
              },
            ],
          };
        }
    
        case 'list': {
          const schemaList = await assetsApi.schemaList({
            startAt,
            maxResults,
          });
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(schemaList, null, 2),
              },
            ],
          };
        }
    
        case 'create': {
          if (!args.name) {
            throw new McpError(ErrorCode.InvalidParams, 'Name is required for create operation');
          }
    
          const newSchema = await assetsApi.schemaCreate({
            objectSchemaIn: {
              name: args.name,
              description: args.description || '',
            },
          });
    
          // Refresh the schema cache for the new schema
          await schemaCacheManager.refreshSchema(newSchema.id);
          console.error(`Schema cache refreshed for new schema ${newSchema.id}`);
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(newSchema, null, 2),
              },
            ],
          };
        }
    
        case 'update': {
          if (!schemaId) {
            throw new McpError(ErrorCode.InvalidParams, 'Schema ID is required for update operation');
          }
    
          // First get the existing schema
          const existingSchema = await assetsApi.schemaFind({ id: schemaId }) as {
              name: string;
              description: string;
            };
    
          // Update with new values
          const updatedSchema = await assetsApi.schemaUpdate({
            id: schemaId,
            objectSchemaIn: {
              name: args.name || existingSchema.name,
              description: args.description !== undefined ? args.description : existingSchema.description,
            },
          });
    
          // Refresh the schema cache for the updated schema
          await schemaCacheManager.refreshSchema(schemaId);
          console.error(`Schema cache refreshed for updated schema ${schemaId}`);
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(updatedSchema, null, 2),
              },
            ],
          };
        }
    
        case 'delete': {
          if (!schemaId) {
            throw new McpError(ErrorCode.InvalidParams, 'Schema ID is required for delete operation');
          }
    
          await assetsApi.schemaDelete({ id: schemaId });
    
          // Refresh all schemas after deletion to ensure consistency
          await schemaCacheManager.refreshAllSchemas();
          console.error('Schema cache refreshed after schema deletion');
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({ success: true, message: `Schema ${schemaId} deleted successfully` }, null, 2),
              },
            ],
          };
        }
    
        default:
          throw new McpError(ErrorCode.InvalidParams, `Unsupported operation: ${operation}`);
        }
      } catch (error) {
        console.error('Error in schema handler:', error);
        
        if (error instanceof McpError) {
          throw error;
        }
        
        // Use the new error handler with context
        return handleError(error, operation, {
          schemaId,
          name: args.name,
          description: args.description,
          startAt,
          maxResults,
          expand: args.expand
        });
      }
    }
  • Input schema definition for the 'manage_jira_insight_schema' tool, specifying parameters for CRUD operations including operation type, schemaId, name, description, pagination (startAt, maxResults), and expand options.
    manage_jira_insight_schema: {
      name: 'manage_jira_insight_schema',
      description: 'Manage Jira Insights object schemas with CRUD operations',
      inputSchema: {
        type: 'object',
        properties: {
          operation: {
            type: 'string',
            enum: ['get', 'list', 'create', 'update', 'delete'],
            description: 'Operation to perform on the schema',
          },
          // Parameters for get, update, delete operations
          schemaId: {
            type: 'string',
            description: 'The ID of the schema. Required for get, update, and delete operations. Can also use snake_case "schema_id".',
          },
          // Parameters for create and update operations
          name: {
            type: 'string',
            description: 'Name of the schema. Required for create operation, optional for update.',
          },
          description: {
            type: 'string',
            description: 'Description of the schema. Optional for create/update.',
          },
          // Parameters for list operation
          startAt: {
            type: 'integer',
            description: 'Index of the first schema to return (0-based). Used for list operation. Can also use snake_case "start_at".',
            default: 0,
          },
          maxResults: {
            type: 'integer',
            description: 'Maximum number of schemas to return. Used for list operation. Can also use snake_case "max_results".',
            default: 50,
          },
          // Common expansion options
          expand: {
            type: 'array',
            items: {
              type: 'string',
              enum: ['objectTypes', 'attributes', 'statistics'],
            },
            description: 'Optional fields to include in the response',
          },
        },
        required: ['operation'],
      },
    },
  • src/index.ts:152-154 (registration)
    Conditional dispatch in the MCP CallToolRequestHandler that routes requests for the 'manage_jira_insight_schema' tool to the setupSchemaHandlers function.
    if (['manage_jira_insight_schema'].includes(name)) {
      response = await setupSchemaHandlers(this.server, this.jiraClient, this.schemaCacheManager, request);
    }
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 but only states 'manage with CRUD operations.' It doesn't describe authentication requirements, rate limits, error conditions, what 'delete' actually destroys, or response formats. For a multi-operation tool with mutation capabilities, this leaves significant behavioral gaps.

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 that directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded with the core purpose, though it could benefit from more detail given 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?

For a complex tool with 7 parameters supporting 5 different operations (including destructive ones like delete) and no output schema or annotations, the description is inadequate. It doesn't explain return values, error handling, or operational constraints, leaving the agent with insufficient context to use the tool effectively.

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%, so the schema already documents all 7 parameters thoroughly. The description adds no parameter-specific information beyond the generic 'CRUD operations' mention, which doesn't provide additional semantic context about individual parameters or their relationships.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool manages Jira Insights object schemas with CRUD operations, which provides a general purpose but lacks specificity about what 'manage' entails. It doesn't distinguish this schema management tool from its sibling object and object type management tools, leaving the scope vague.

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 about when to use this tool versus its siblings (manage_jira_insight_object and manage_jira_insight_object_type). The description mentions CRUD operations but doesn't specify contexts, prerequisites, or exclusions for choosing this schema management tool over 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

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/aaronsb/jira-insights-mcp'

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