Skip to main content
Glama

getPersonById

Retrieve specific person details using their unique ID from the Teamwork platform. This tool fetches individual records to access contact information, roles, or project assignments.

Instructions

Get a specific person by ID from Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
personIdYesThe ID of the person to retrieve

Implementation Reference

  • The handler function that implements the core logic of the getPersonById tool. It validates the input personId, calls the underlying teamworkService.getPersonById, handles the response by stringifying to JSON, and manages errors appropriately.
    export async function handleGetPersonById(input: any) {
      logger.info('=== getPersonById tool called ===');
      logger.info(`Input parameters: ${JSON.stringify(input || {})}`);
      
      try {
        if (!input.personId) {
          logger.error('Missing required parameter: personId');
          return {
            content: [{
              type: "text",
              text: "Error: Missing required parameter 'personId'"
            }]
          };
        }
        
        const personId = parseInt(input.personId, 10);
        if (isNaN(personId)) {
          logger.error(`Invalid personId: ${input.personId}`);
          return {
            content: [{
              type: "text",
              text: `Error: Invalid personId. Must be a number.`
            }]
          };
        }
        
        logger.info(`Calling teamworkService.getPersonById(${personId})`);
        const person = await teamworkService.getPersonById(personId);
        
        // Debug the response
        logger.info(`Person response type: ${typeof person}`);
        
        if (person === null || person === undefined) {
          logger.warn(`Person with ID ${personId} not found or API returned empty response`);
          return {
            content: [{
              type: "text",
              text: `No person found with ID ${personId} or API returned empty response.`
            }]
          };
        }
        
        try {
          const jsonString = JSON.stringify(person, null, 2);
          logger.info(`Successfully stringified person response`);
          logger.info('=== getPersonById tool completed successfully ===');
          return {
            content: [{
              type: "text",
              text: jsonString
            }]
          };
        } catch (jsonError: any) {
          logger.error(`JSON stringify error: ${jsonError.message}`);
          return {
            content: [{
              type: "text",
              text: `Error formatting response: ${jsonError.message}`
            }]
          };
        }
      } catch (error: any) {
        return createErrorResponse(error, 'Retrieving person');
      }
    } 
  • The tool schema definition, including name, description, inputSchema for personId (required integer), and annotations for UI hints.
    export const getPersonByIdDefinition = {
      name: "getPersonById",
      description: "Get a specific person by ID from Teamwork",
      inputSchema: {
        type: "object",
        properties: {
          personId: {
            type: "integer",
            description: "The ID of the person to retrieve"
          }
        },
        required: ["personId"]
      },
      annotations: {
        title: "Get a Person by their ID",
        readOnlyHint: false,
        destructiveHint: false,
        openWorldHint: false
      }
    };
  • Registration of the getPersonById tool in the central toolPairs array, which populates toolDefinitions and toolHandlersMap for MCP tool exposure.
    { definition: getPersonById, handler: handleGetPersonById },
  • Helper service function that performs the actual API call to Teamwork to retrieve person data by ID, used by the tool handler.
    export const getPersonById = async (personId: number, params?: Omit<PeopleQueryParams, 'personId'>) => {
      try {
        logger.info(`Fetching person with ID ${personId} from Teamwork API`);
        
        const api = ensureApiClient();
        const response = await api.get(`/people/${personId}.json`, { params });
        logger.info(`Successfully fetched person with ID ${personId}`);
        return response.data;
      } catch (error: any) {
        logger.error(`Teamwork API error: ${error.message}`);
        throw new Error(`Failed to fetch person with ID ${personId} from Teamwork API`);
      }
    };
Behavior3/5

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

Annotations indicate readOnlyHint=false, openWorldHint=false, and destructiveHint=false, but the description doesn't add behavioral context beyond this. It doesn't explain implications like whether it requires specific permissions, rate limits, or error handling, though annotations cover basic safety. No contradiction with annotations exists.

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 purpose without unnecessary words. It's front-loaded and appropriately sized for a simple retrieval tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no output schema) and annotations covering basic hints, the description is minimally adequate. However, it lacks details on output format or error cases, which could be helpful despite the absence of an output schema.

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 parameter 'personId' fully documented in the schema. The description doesn't add any extra meaning or context about the parameter beyond what the schema provides, so it meets the baseline for high coverage.

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 person by ID from Teamwork'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'getPeople' or 'getProjectPerson', which also retrieve person data, so it misses full sibling distinction.

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 such as 'getPeople' for listing multiple persons or 'getProjectPerson' for person data within a project context. It lacks explicit when/when-not instructions or named 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

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/Vizioz/Teamwork-MCP'

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