Class PreMcpToolCallHookInput

java.lang.Object
com.github.copilot.rpc.PreMcpToolCallHookInput

public class PreMcpToolCallHookInput extends Object
Input for a pre-MCP-tool-call hook.

This hook fires before an MCP tool call is dispatched to an MCP server, allowing you to inspect or modify the request metadata.

Since:
1.0.8
  • Constructor Details

    • PreMcpToolCallHookInput

      public PreMcpToolCallHookInput()
  • Method Details

    • getSessionId

      public String getSessionId()
      Gets the runtime session ID of the session that triggered the hook.
      Returns:
      the session ID
    • setSessionId

      public PreMcpToolCallHookInput setSessionId(String sessionId)
      Sets the runtime session ID of the session that triggered the hook.
      Parameters:
      sessionId - the session ID
      Returns:
      this instance for method chaining
    • getTimestamp

      public long getTimestamp()
      Gets the timestamp of the hook invocation.
      Returns:
      the timestamp in milliseconds
    • setTimestamp

      public PreMcpToolCallHookInput setTimestamp(long timestamp)
      Sets the timestamp of the hook invocation.
      Parameters:
      timestamp - the timestamp in milliseconds
      Returns:
      this instance for method chaining
    • getCwd

      public String getCwd()
      Gets the current working directory.
      Returns:
      the working directory path
    • setCwd

      public PreMcpToolCallHookInput setCwd(String cwd)
      Sets the current working directory.
      Parameters:
      cwd - the working directory path
      Returns:
      this instance for method chaining
    • getServerName

      public String getServerName()
      Gets the name of the MCP server being called.
      Returns:
      the server name
    • setServerName

      public PreMcpToolCallHookInput setServerName(String serverName)
      Sets the name of the MCP server being called.
      Parameters:
      serverName - the server name
      Returns:
      this instance for method chaining
    • getToolName

      public String getToolName()
      Gets the name of the MCP tool being called.
      Returns:
      the tool name
    • setToolName

      public PreMcpToolCallHookInput setToolName(String toolName)
      Sets the name of the MCP tool being called.
      Parameters:
      toolName - the tool name
      Returns:
      this instance for method chaining
    • getArguments

      public com.fasterxml.jackson.databind.JsonNode getArguments()
      Gets the arguments for the MCP tool call.
      Returns:
      the arguments as a JSON node, or null
    • setArguments

      public PreMcpToolCallHookInput setArguments(com.fasterxml.jackson.databind.JsonNode arguments)
      Sets the arguments for the MCP tool call.
      Parameters:
      arguments - the arguments as a JSON node
      Returns:
      this instance for method chaining
    • getToolCallId

      public String getToolCallId()
      Gets the tool call ID, if available.
      Returns:
      the tool call ID, or null
    • setToolCallId

      public PreMcpToolCallHookInput setToolCallId(String toolCallId)
      Sets the tool call ID.
      Parameters:
      toolCallId - the tool call ID
      Returns:
      this instance for method chaining
    • getMeta

      public Map<String,com.fasterxml.jackson.databind.JsonNode> getMeta()
      Gets the MCP request metadata, if present.
      Returns:
      the metadata map, or null
    • setMeta

      public PreMcpToolCallHookInput setMeta(Map<String,com.fasterxml.jackson.databind.JsonNode> meta)
      Sets the MCP request metadata.
      Parameters:
      meta - the metadata map
      Returns:
      this instance for method chaining