Skip to main content
Glama
Ucode-io

Postman MCP Generator

by Ucode-io

update_data

Modify entity details in the Ucode Items API by specifying the new name and unique identifier. Streamline data updates with direct integration.

Instructions

Update data on the Ucode Items API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe identifier of the entity to be updated.
nameYesThe new name to update in the data.

Implementation Reference

  • The executeFunction implements the core handler logic for the 'update_data' tool: sends a PUT request to update the entity with the given id and new name.
    const executeFunction = async ({ name, id }) => {
      const baseUrl = 'https://postman-rest-api-learner.glitch.me/';
      const token = process.env.UCODE_PUBLIC_APIS_API_KEY;
      try {
        // Construct the URL with query parameters
        const url = new URL(`${baseUrl}/info`);
        url.searchParams.append('id', id);
    
        // Set up headers for the request
        const headers = {
          'Content-Type': 'application/json',
        };
    
        // Prepare the body of the request
        const body = JSON.stringify({ name });
    
        // Perform the fetch request
        const response = await fetch(url.toString(), {
          method: 'PUT',
          headers,
          body,
        });
    
        // Check if the response was successful
        if (!response.ok) {
          const errorData = await response.json();
          throw new Error(errorData);
        }
    
        // Parse and return the response data
        const data = await response.json();
        return data;
      } catch (error) {
        console.error('Error updating data:', error);
        return { error: 'An error occurred while updating data.' };
      }
    };
  • The JSON schema defining the input parameters for 'update_data': object with required 'name' (string) and 'id' (integer).
    definition: {
      type: 'function',
      function: {
        name: 'update_data',
        description: 'Update data on the Ucode Items API.',
        parameters: {
          type: 'object',
          properties: {
            name: {
              type: 'string',
              description: 'The new name to update in the data.'
            },
            id: {
              type: 'integer',
              description: 'The identifier of the entity to be updated.'
            }
          },
          required: ['name', 'id']
        }
      }
    }
  • lib/tools.js:7-16 (registration)
    The discoverTools() function dynamically imports and collects apiTool objects from all listed tool paths, including 'update_data', preparing them for MCP server registration.
    export async function discoverTools() {
      const toolPromises = toolPaths.map(async (file) => {
        const module = await import(`../tools/${file}`);
        return {
          ...module.apiTool,
          path: file,
        };
      });
      return Promise.all(toolPromises);
    }
  • tools/paths.js:1-5 (registration)
    Central list of tool file paths; includes the path to the 'update_data' tool implementation, used by discoverTools.
    export const toolPaths = [
      'ucode-public-apis/ucode-items-ap-is/post-data.js',
      'ucode-public-apis/ucode-items-ap-is/get-data.js',
      'ucode-public-apis/ucode-items-ap-is/delete-data.js',
      'ucode-public-apis/ucode-items-ap-is/update-data.js'
  • mcpServer.js:40-80 (registration)
    Registers the MCP server handlers for listing tools and calling tools by name; uses the tools array from discoverTools to handle calls to 'update_data'.
    async function setupServerHandlers(server, tools) {
      server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: await transformTools(tools),
      }));
    
      server.setRequestHandler(CallToolRequestSchema, async (request) => {
        const toolName = request.params.name;
        const tool = tools.find((t) => t.definition.function.name === toolName);
        if (!tool) {
          throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${toolName}`);
        }
        const args = request.params.arguments;
        const requiredParameters =
          tool.definition?.function?.parameters?.required || [];
        for (const requiredParameter of requiredParameters) {
          if (!(requiredParameter in args)) {
            throw new McpError(
              ErrorCode.InvalidParams,
              `Missing required parameter: ${requiredParameter}`
            );
          }
        }
        try {
          const result = await tool.function(args);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        } catch (error) {
          console.error("[Error] Failed to fetch data:", error);
          throw new McpError(
            ErrorCode.InternalError,
            `API error: ${error.message}`
          );
        }
      });
    }
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 'Update data,' which implies a mutation operation, but doesn't cover permissions, side effects, error handling, or response format. For a mutation tool without annotations, this is insufficient to inform the agent adequately.

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. It's front-loaded with the core action and target, making it easy to parse. Every part of the sentence contributes directly to the tool's purpose, earning a high score for conciseness.

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 complexity of a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits, usage context, and return values, which are critical for an agent to operate effectively. The schema covers parameters well, but overall context is insufficient.

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?

The input schema has 100% description coverage, clearly documenting both parameters ('id' and 'name'). The description adds no additional meaning beyond what the schema provides, such as format examples or constraints. According to the rules, with high schema coverage, the baseline is 3, which is appropriate here.

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 action ('Update') and target ('data on the Ucode Items API'), which is clear but vague. It doesn't specify what type of data or entity is being updated, and it doesn't differentiate from sibling tools like 'post_data' (create) or 'delete_data' (remove). The purpose is understandable but lacks specificity.

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 'post_data' for creation or 'delete_data' for removal. The description implies it's for updates but doesn't clarify prerequisites, such as needing an existing entity ID, or contextual constraints. This leaves the agent with minimal direction.

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/Ucode-io/mcp-server'

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