@chinchillaenterprises/mcp-upwork
Version:
Modular Upwork MCP server for job search and proposal management via Upwork API
37 lines (32 loc) • 1.16 kB
text/typescript
import { Tool } from "@modelcontextprotocol/sdk/types.js";
import { GetContractDetailsArgsSchema } from "../../schemas/upwork.js";
import { UpworkClient } from "../../services/upwork-client.js";
import { z } from "zod";
export const toolDefinition: Tool = {
name: "upwork_get_contract_details",
description: "Get detailed information about a specific contract including terms, payments, and milestones",
inputSchema: {
type: "object",
properties: {
contractId: {
type: "string",
description: "The unique identifier of the contract"
}
},
required: ["contractId"]
}
};
export const handler = async (args: z.infer<typeof GetContractDetailsArgsSchema>) => {
try {
const client = UpworkClient.getInstance();
const response = await client.get(`/hr/v2/contracts/${args.contract_id}`);
return {
success: true,
contract: response.contract || response,
contractId: args.contract_id
};
} catch (error: any) {
throw new Error(`Failed to get contract details: ${error.message}`);
}
};
export { GetContractDetailsArgsSchema as schema } from "../../schemas/upwork.js";